Skip to content

Commit f7d2abf

Browse files
committed
JS: Unfold local type aliases in getAnUnderlyingType
1 parent 91e9b23 commit f7d2abf

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

javascript/ql/lib/semmle/javascript/TypeScript.qll

+11
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,17 @@ class LocalTypeAccess extends @local_type_access, TypeAccess, Identifier, Lexica
773773
*/
774774
LocalTypeName getLocalTypeName() { result.getAnAccess() = this }
775775

776+
private TypeAliasDeclaration getAlias() {
777+
this.getLocalTypeName().getADeclaration() = result.getIdentifier()
778+
}
779+
780+
override TypeExpr getAnUnderlyingType() {
781+
result = this.getAlias().getDefinition().getAnUnderlyingType()
782+
or
783+
not exists(this.getAlias()) and
784+
result = this
785+
}
786+
776787
override string getAPrimaryQlClass() { result = "LocalTypeAccess" }
777788
}
778789

javascript/ql/test/library-tests/frameworks/HTTP/RemoteRequestInput.expected

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
| connect.js:6:5:6:11 | req.url | url |
22
| connect.js:7:5:7:21 | req.cookies.get() | cookie |
33
| express-typed.ts:4:5:4:12 | req.body | body |
4+
| express-typed.ts:10:5:10:12 | req.body | body |
45
| express.js:12:5:12:19 | req.param("p1") | parameter |
56
| express.js:13:5:13:17 | req.params.p2 | parameter |
67
| express.js:14:5:14:16 | req.query.p3 | parameter |

0 commit comments

Comments
 (0)