TS: fix analysis of export= statements

This commit is contained in:
Asger F
2019-04-23 13:09:40 +01:00
parent 45a35a8572
commit 08bc29cddb
3 changed files with 21 additions and 1 deletions

View File

@@ -156,7 +156,12 @@ private class AnalyzedImport extends AnalyzedPropertyRead, DataFlow::ValueNode {
or
// when importing CommonJS/AMD modules from ES2015, `module.exports` appears
// as the default export
not imported instanceof ES2015Module and
(
not imported instanceof ES2015Module
or
// CommonJS/AMD module generated by TypeScript compiler
imported.getAStmt() instanceof ExportAssignDeclaration
) and
astNode.(ImportSpecifier).getImportedName() = "default" and
base = TAbstractModuleObject(imported) and
propName = "exports"

View File

@@ -0,0 +1,10 @@
import * as dummy from "dummy"; // treat as ES module
class C {
public x: int;
constructor() {}
static async staticMethod() {}
}
export = C;

View File

@@ -0,0 +1,5 @@
import C from "./export_equals";
function f() {
C.staticMethod(); // OK
}