TS: Fix handling of 'export ='

This commit is contained in:
Asger F
2019-04-30 10:27:40 +01:00
parent 11c07a3217
commit 686d72c356
6 changed files with 39 additions and 1 deletions

View File

@@ -372,7 +372,9 @@ function handleOpenProjectCommand(command: OpenProjectCommand) {
function getEffectiveExportTarget(symbol: ts.Symbol) {
if (symbol.exports != null && symbol.exports.has(ts.InternalSymbolName.ExportEquals)) {
let exportAlias = symbol.exports.get(ts.InternalSymbolName.ExportEquals);
return typeChecker.getAliasedSymbol(exportAlias);
if (exportAlias.flags & ts.SymbolFlags.Alias) {
return typeChecker.getAliasedSymbol(exportAlias);
}
}
return symbol;
}

View File

@@ -0,0 +1,14 @@
class Foo {}
declare module 'foo' {
export = new Foo();
}
declare module 'bar' {
import * as baz from "baz";
export = baz;
}
declare module 'baz' {
export class C {}
}

View File

@@ -0,0 +1,7 @@
| "bar" in global scope |
| C in module 'bar' |
| Foo in global scope |
| Foo in tst.ts |
| module 'bar' |
| module 'foo' |
| tst.ts |

View File

@@ -0,0 +1,4 @@
import javascript
from CanonicalName name
select name

View File

@@ -0,0 +1,6 @@
{
"include": ["."],
"compilerOptions": {
"esModuleInterop": true
}
}

View File

@@ -0,0 +1,5 @@
import self from "./tst";
class Foo {}
export = new Foo();