Skip to content

Commit 9934996

Browse files
committed
TS: Fix handling of 'export ='
1 parent faba019 commit 9934996

File tree

6 files changed

+39
-1
lines changed

6 files changed

+39
-1
lines changed

javascript/extractor/lib/typescript/src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,9 @@ function handleOpenProjectCommand(command: OpenProjectCommand) {
360360
function getEffectiveExportTarget(symbol: ts.Symbol) {
361361
if (symbol.exports != null && symbol.exports.has(ts.InternalSymbolName.ExportEquals)) {
362362
let exportAlias = symbol.exports.get(ts.InternalSymbolName.ExportEquals);
363-
return typeChecker.getAliasedSymbol(exportAlias);
363+
if (exportAlias.flags & ts.SymbolFlags.Alias) {
364+
return typeChecker.getAliasedSymbol(exportAlias);
365+
}
364366
}
365367
return symbol;
366368
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Foo {}
2+
3+
declare module 'foo' {
4+
export = new Foo();
5+
}
6+
7+
declare module 'bar' {
8+
import * as baz from "baz";
9+
export = baz;
10+
}
11+
12+
declare module 'baz' {
13+
export class C {}
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
| "bar" in global scope |
2+
| C in module 'bar' |
3+
| Foo in global scope |
4+
| Foo in tst.ts |
5+
| module 'bar' |
6+
| module 'foo' |
7+
| tst.ts |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import javascript
2+
3+
from CanonicalName name
4+
select name
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"include": ["."],
3+
"compilerOptions": {
4+
"esModuleInterop": true
5+
}
6+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import self from "./tst";
2+
3+
class Foo {}
4+
5+
export = new Foo();

0 commit comments

Comments
 (0)