Skip to content

Commit 69de046

Browse files
committed
Merge pull request microsoft#3041 from Microsoft/fixCircularAliasError
Fix circular alias error
2 parents 6c934aa + f08d379 commit 69de046

File tree

6 files changed

+44
-3
lines changed

6 files changed

+44
-3
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,9 @@ module ts {
350350
}
351351
else if (location.kind === SyntaxKind.SourceFile ||
352352
(location.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>location).name.kind === SyntaxKind.StringLiteral)) {
353-
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & SymbolFlags.ModuleMember);
353+
result = getSymbolOfNode(location).exports["default"];
354354
let localSymbol = getLocalSymbolForExportDefault(result);
355-
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
355+
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
356356
break loop;
357357
}
358358
result = undefined;

src/compiler/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,7 @@ module ts {
16951695
}
16961696

16971697
export function getLocalSymbolForExportDefault(symbol: Symbol) {
1698-
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
1698+
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
16991699
}
17001700

17011701
/**
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//// [exportDefaultVariable.ts]
2+
// Regression test for #3018
3+
4+
declare var io: any;
5+
6+
declare module 'module' {
7+
export default io;
8+
}
9+
10+
11+
//// [exportDefaultVariable.js]
12+
// Regression test for #3018
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
=== tests/cases/compiler/exportDefaultVariable.ts ===
2+
// Regression test for #3018
3+
4+
declare var io: any;
5+
>io : Symbol(io, Decl(exportDefaultVariable.ts, 2, 11))
6+
7+
declare module 'module' {
8+
export default io;
9+
>io : Symbol(default, Decl(exportDefaultVariable.ts, 2, 11))
10+
}
11+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
=== tests/cases/compiler/exportDefaultVariable.ts ===
2+
// Regression test for #3018
3+
4+
declare var io: any;
5+
>io : any
6+
7+
declare module 'module' {
8+
export default io;
9+
>io : any
10+
}
11+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Regression test for #3018
2+
3+
declare var io: any;
4+
5+
declare module 'module' {
6+
export default io;
7+
}

0 commit comments

Comments
 (0)