Skip to content

Commit 1454c56

Browse files
committed
JS: Test with namespaces and their various imports/exports
1 parent 94c8ec8 commit 1454c56

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

javascript/ql/lib/semmle/javascript/internal/UnderlyingTypes.qll

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ module UnderlyingTypes {
6161
or
6262
exists(Node mid |
6363
nodeRefersToModule(mid, mod, qualifiedName) and
64-
ValueFlow::step(mid, node) and
65-
// avoid a lot of unnecessary tuples
66-
not (
67-
node instanceof Variable and
68-
not node = any(LocalVarTypeAccess ac).getVariable() // needed for TypeofTypeExpr
69-
)
64+
ValueFlow::step(mid, node)
7065
)
7166
or
7267
exists(Node mid, string prefix, string step |
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import Express = require('express');
2+
3+
namespace A {
4+
export import E = Express;
5+
}
6+
namespace B {
7+
export import Q = A
8+
}
9+
namespace C {
10+
import E = Express;
11+
export const A = E;
12+
}
13+
14+
function t1(x: A.E.Request) { // $ hasUnderlyingType='express'.Request
15+
}
16+
17+
function t2(x: B.Q.E.Request) { // $ hasUnderlyingType='express'.Request
18+
}
19+
20+
function t3(x: typeof Express) { // $ hasUnderlyingType='express'
21+
}
22+
23+
function t4(x: typeof A.E) { // $ hasUnderlyingType='express'
24+
}
25+
26+
function t5(x: typeof C.A) { // $ hasUnderlyingType='express'
27+
}

0 commit comments

Comments
 (0)