mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
TS: fix analysis of export= statements
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import * as dummy from "dummy"; // treat as ES module
|
||||
|
||||
class C {
|
||||
public x: int;
|
||||
constructor() {}
|
||||
|
||||
static async staticMethod() {}
|
||||
}
|
||||
|
||||
export = C;
|
||||
@@ -0,0 +1,5 @@
|
||||
import C from "./export_equals";
|
||||
|
||||
function f() {
|
||||
C.staticMethod(); // OK
|
||||
}
|
||||
Reference in New Issue
Block a user