diff --git a/javascript/ql/lib/semmle/javascript/ES2015Modules.qll b/javascript/ql/lib/semmle/javascript/ES2015Modules.qll index de9bb022afc..ecce9621c24 100644 --- a/javascript/ql/lib/semmle/javascript/ES2015Modules.qll +++ b/javascript/ql/lib/semmle/javascript/ES2015Modules.qll @@ -543,13 +543,16 @@ class ExportNamedDeclaration extends ExportDeclaration, @export_named_declaratio VarDecl getADecl() { result = this.getAnExportedDecl() } override predicate exportsDirectlyAs(LexicalName v, string name) { - exists(LexicalDecl vd | vd = this.getAnExportedDecl() | - name = vd.getName() and v = vd.getALexicalName() - ) - or - exists(ExportSpecifier spec | spec = this.getASpecifier() and name = spec.getExportedName() | - v = spec.getLocal().(LexicalAccess).getALexicalName() - ) + ( + exists(LexicalDecl vd | vd = this.getAnExportedDecl() | + name = vd.getName() and v = vd.getALexicalName() + ) + or + exists(ExportSpecifier spec | spec = this.getASpecifier() and name = spec.getExportedName() | + v = spec.getLocal().(LexicalAccess).getALexicalName() + ) + ) and + not (this.isTypeOnly() and v instanceof Variable) } override DataFlow::Node getDirectSourceNode(string name) { @@ -600,18 +603,6 @@ private class ExportNamespaceStep extends PreCallGraphStep { } } -/** - * An export declaration with the `type` modifier. - */ -private class TypeOnlyExportDeclaration extends ExportNamedDeclaration { - TypeOnlyExportDeclaration() { this.isTypeOnly() } - - override predicate exportsDirectlyAs(LexicalName v, string name) { - super.exportsDirectlyAs(v, name) and - not v instanceof Variable - } -} - /** * An export specifier in an export declaration. * @@ -834,7 +825,8 @@ class SelectiveReExportDeclaration extends ReExportDeclaration, ExportNamedDecla override predicate reExportsAs(LexicalName v, string name) { exists(ExportSpecifier spec | spec = this.getASpecifier() and name = spec.getExportedName() | this.getReExportedES2015Module().exportsAs(v, spec.getLocalName()) - ) + ) and + not (this.isTypeOnly() and v instanceof Variable) } overlay[global]