Skip to content

Commit 060aa8c

Browse files
authored
Merge pull request #1274 from asger-semmle/ts-export-equals
Approved by xiemaisi
2 parents 45a35a8 + 08bc29c commit 060aa8c

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

javascript/ql/src/semmle/javascript/dataflow/internal/InterModuleTypeInference.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,12 @@ private class AnalyzedImport extends AnalyzedPropertyRead, DataFlow::ValueNode {
156156
or
157157
// when importing CommonJS/AMD modules from ES2015, `module.exports` appears
158158
// as the default export
159-
not imported instanceof ES2015Module and
159+
(
160+
not imported instanceof ES2015Module
161+
or
162+
// CommonJS/AMD module generated by TypeScript compiler
163+
imported.getAStmt() instanceof ExportAssignDeclaration
164+
) and
160165
astNode.(ImportSpecifier).getImportedName() = "default" and
161166
base = TAbstractModuleObject(imported) and
162167
propName = "exports"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import * as dummy from "dummy"; // treat as ES module
2+
3+
class C {
4+
public x: int;
5+
constructor() {}
6+
7+
static async staticMethod() {}
8+
}
9+
10+
export = C;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import C from "./export_equals";
2+
3+
function f() {
4+
C.staticMethod(); // OK
5+
}

0 commit comments

Comments
 (0)