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 {
4646 this instanceof Module
4747 or
4848 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
4952 }
5053 }
5154
@@ -230,6 +233,19 @@ module NameResolution {
230233 name = expr .getName ( ) and
231234 node2 = expr
232235 )
236+ or
237+ exists ( AwaitExpr await |
238+ node1 = await .getOperand ( ) and
239+ name = "$$promise-content" and
240+ node2 = await
241+ )
242+ or
243+ exists ( MethodCallExpr call |
244+ call .getMethodName ( ) = "then" and
245+ node1 = call .getReceiver ( ) and
246+ name = "$$promise-content" and
247+ node2 = call .getArgument ( 0 ) .( Function ) .getParameter ( 0 )
248+ )
233249 }
234250
235251 private signature module TypeResolutionInputSig {
@@ -306,6 +322,12 @@ module NameResolution {
306322 )
307323 or
308324 storeToVariable ( result , name , mod .( Closure:: ClosureModule ) .getExportsVariable ( ) )
325+ or
326+ exists ( DynamicImportExpr imprt |
327+ mod = imprt and
328+ name = "$$promise-content" and
329+ result = imprt .getImportedPathExpr ( )
330+ )
309331 }
310332
311333 /**
Original file line number Diff line number Diff line change 11async function t1 ( ) {
22 const e = await import ( './dynamicImportLib' ) ;
3- e . getRequest ( ) ; // $ MISSING: hasUnderlyingType='express'.Request
3+ e . getRequest ( ) ; // $ hasUnderlyingType='express'.Request
44}
Original file line number Diff line number Diff line change 1515| contextualTypes.ts:27:16:27:18 | req | 'express'.Request |
1616| contextualTypes.ts:34:20:34:22 | req | 'express'.Request |
1717| contextualTypes.ts:41:16:41:18 | req | 'express'.Request |
18+ | dynamicImportUse.ts:3:5:3:18 | e.getRequest() | 'express'.Request |
1819| expressBulkExport.use.ts:3:13:3:15 | req | 'express'.Request |
1920| expressBulkExport.use.ts:6:13:6:15 | res | 'express'.Response |
2021| expressExportAssign.use.ts:3:13:3:15 | req | 'express'.Request |
You can’t perform that action at this time.
0 commit comments