File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
lib/semmle/javascript/internal
test/library-tests/UnderlyingTypes Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ module NameResolution {
46
46
this instanceof Module
47
47
or
48
48
this instanceof NamespaceDefinition // `module {}` or `enum {}` statement
49
+ or
50
+ // A module wrapped in a promise. We model this as a module exporting the actual module in a property called `$$promise-content`.
51
+ this instanceof DynamicImportExpr
49
52
}
50
53
}
51
54
@@ -232,6 +235,19 @@ module NameResolution {
232
235
name = expr .getName ( ) and
233
236
node2 = expr
234
237
)
238
+ or
239
+ exists ( AwaitExpr await |
240
+ node1 = await .getOperand ( ) and
241
+ name = "$$promise-content" and
242
+ node2 = await
243
+ )
244
+ or
245
+ exists ( MethodCallExpr call |
246
+ call .getMethodName ( ) = "then" and
247
+ node1 = call .getReceiver ( ) and
248
+ name = "$$promise-content" and
249
+ node2 = call .getArgument ( 0 ) .( Function ) .getParameter ( 0 )
250
+ )
235
251
}
236
252
237
253
private signature module TypeResolutionInputSig {
@@ -334,6 +350,12 @@ module NameResolution {
334
350
)
335
351
or
336
352
storeToVariable ( result , name , mod .( Closure:: ClosureModule ) .getExportsVariable ( ) )
353
+ or
354
+ exists ( DynamicImportExpr imprt |
355
+ mod = imprt and
356
+ name = "$$promise-content" and
357
+ result = imprt .getImportedPathExpr ( )
358
+ )
337
359
}
338
360
339
361
/**
Original file line number Diff line number Diff line change 1
1
async function t1 ( ) {
2
2
const e = await import ( './dynamicImportLib' ) ;
3
- e . getRequest ( ) ; // $ MISSING: hasUnderlyingType='express'.Request
3
+ e . getRequest ( ) ; // $ hasUnderlyingType='express'.Request
4
4
}
Original file line number Diff line number Diff line change 15
15
| contextualTypes.ts:27:16:27:18 | req | 'express'.Request |
16
16
| contextualTypes.ts:34:20:34:22 | req | 'express'.Request |
17
17
| contextualTypes.ts:41:16:41:18 | req | 'express'.Request |
18
+ | dynamicImportUse.ts:3:5:3:18 | e.getRequest() | 'express'.Request |
18
19
| expressBulkExport.use.ts:3:13:3:15 | req | 'express'.Request |
19
20
| expressBulkExport.use.ts:6:13:6:15 | res | 'express'.Response |
20
21
| expressExportAssign.use.ts:3:13:3:15 | req | 'express'.Request |
You can’t perform that action at this time.
0 commit comments