Merge pull request #1274 from asger-semmle/ts-export-equals

Approved by xiemaisi
This commit is contained in:
semmle-qlci
2019-04-23 17:07:52 +01:00
committed by GitHub
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
}