mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
JS: More robust hasUnderlyingType
This commit is contained in:
@@ -725,7 +725,7 @@ class TypeAccess extends @typeaccess, TypeExpr, TypeRef {
|
||||
spec.getImportedName() = exportedName and
|
||||
this = spec.getLocal().(TypeDecl).getLocalTypeName().getAnAccess()
|
||||
or
|
||||
spec instanceof ImportNamespaceSpecifier and
|
||||
(spec instanceof ImportNamespaceSpecifier or spec instanceof ImportDefaultSpecifier) and
|
||||
this =
|
||||
spec.getLocal().(LocalNamespaceDecl).getLocalNamespaceName().getAMemberAccess(exportedName)
|
||||
)
|
||||
|
||||
@@ -239,7 +239,6 @@ module DataFlow {
|
||||
private TypeAnnotation getFallbackTypeAnnotation() {
|
||||
exists(BindingPattern pattern |
|
||||
this = valueNode(pattern) and
|
||||
not ast_node_type(pattern, _) and
|
||||
result = pattern.getTypeAnnotation()
|
||||
)
|
||||
or
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
underlyingTypeNode
|
||||
| foo | Bar | foo.ts:3:1:5:1 | use (instance (member Bar (member exports (module foo)))) |
|
||||
| foo | Bar | foo.ts:3:12:3:12 | use (instance (member Bar (member exports (module foo)))) |
|
||||
#select
|
||||
| tst.ts:8:14:8:16 | arg | Base in global scope |
|
||||
| tst.ts:8:14:8:16 | arg | Sub in global scope |
|
||||
|
||||
@@ -3,3 +3,7 @@ import javascript
|
||||
from Expr e, TypeName typeName
|
||||
where e.getType().hasUnderlyingTypeName(typeName)
|
||||
select e, typeName
|
||||
|
||||
query API::Node underlyingTypeNode(string mod, string name) {
|
||||
result = API::Node::ofType(mod, name)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import foo from "foo";
|
||||
|
||||
function f(x: foo.Bar) {
|
||||
return x;
|
||||
}
|
||||
Reference in New Issue
Block a user