Skip to content

Commit 52f0fe7

Browse files
committed
Revert microsoft#3641, whose original bug has been fixed by other means
1 parent 710f211 commit 52f0fe7

12 files changed

+97
-31
lines changed

src/compiler/checker.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2161,7 +2161,6 @@ namespace ts {
21612161
return forEachEntry(symbols, symbolFromSymbolTable => {
21622162
if (symbolFromSymbolTable.flags & SymbolFlags.Alias
21632163
&& symbolFromSymbolTable.escapedName !== "export="
2164-
&& !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)
21652164
&& !(isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && isExternalModule(getSourceFileOfNode(enclosingDeclaration)))
21662165
// If `!useOnlyExternalAliasing`, we can use any type of alias to get the name
21672166
&& (!useOnlyExternalAliasing || some(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration))) {
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//// [tests/cases/compiler/declarationEmitOfTypeofAliasedExport.ts] ////
2+
3+
//// [a.ts]
4+
class C {}
5+
export { C as D }
6+
7+
//// [b.ts]
8+
import * as a from "./a";
9+
export default a.D;
10+
11+
12+
//// [a.js]
13+
"use strict";
14+
exports.__esModule = true;
15+
var C = /** @class */ (function () {
16+
function C() {
17+
}
18+
return C;
19+
}());
20+
exports.D = C;
21+
//// [b.js]
22+
"use strict";
23+
exports.__esModule = true;
24+
var a = require("./a");
25+
exports["default"] = a.D;
26+
27+
28+
//// [a.d.ts]
29+
declare class C {
30+
}
31+
export { C as D };
32+
//// [b.d.ts]
33+
import * as a from "./a";
34+
declare const _default: typeof a.D;
35+
export default _default;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== /a.ts ===
2+
class C {}
3+
>C : Symbol(C, Decl(a.ts, 0, 0))
4+
5+
export { C as D }
6+
>C : Symbol(D, Decl(a.ts, 1, 8))
7+
>D : Symbol(D, Decl(a.ts, 1, 8))
8+
9+
=== /b.ts ===
10+
import * as a from "./a";
11+
>a : Symbol(a, Decl(b.ts, 0, 6))
12+
13+
export default a.D;
14+
>a.D : Symbol(a.D, Decl(a.ts, 1, 8))
15+
>a : Symbol(a, Decl(b.ts, 0, 6))
16+
>D : Symbol(a.D, Decl(a.ts, 1, 8))
17+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== /a.ts ===
2+
class C {}
3+
>C : C
4+
5+
export { C as D }
6+
>C : typeof C
7+
>D : typeof C
8+
9+
=== /b.ts ===
10+
import * as a from "./a";
11+
>a : typeof a
12+
13+
export default a.D;
14+
>a.D : typeof a.D
15+
>a : typeof a
16+
>D : typeof a.D
17+

tests/baselines/reference/es6ExportClauseWithoutModuleSpecifier.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export { c as c2 } from "server";
3030

3131
export { i, m as instantiatedModule } from "server";
3232
>i : any
33-
>m : typeof m
34-
>instantiatedModule : typeof m
33+
>m : typeof instantiatedModule
34+
>instantiatedModule : typeof instantiatedModule
3535

3636
export { uninstantiated } from "server";
3737
>uninstantiated : any

tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export { c as c2 } from "./server";
3030

3131
export { i, m as instantiatedModule } from "./server";
3232
>i : any
33-
>m : typeof m
34-
>instantiatedModule : typeof m
33+
>m : typeof instantiatedModule
34+
>instantiatedModule : typeof instantiatedModule
3535

3636
export { uninstantiated } from "./server";
3737
>uninstantiated : any

tests/baselines/reference/exportSpecifierForAGlobal.errors.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
tests/cases/compiler/b.ts(1,9): error TS2661: Cannot export 'X'. Only local declarations can be exported from a module.
2+
tests/cases/compiler/b.ts(2,17): error TS4060: Return type of exported function has or is using private name 'X'.
23

34

45
==== tests/cases/compiler/a.d.ts (0 errors) ====
56
declare class X { }
67

7-
==== tests/cases/compiler/b.ts (1 errors) ====
8+
==== tests/cases/compiler/b.ts (2 errors) ====
89
export {X};
910
~
1011
!!! error TS2661: Cannot export 'X'. Only local declarations can be exported from a module.
1112
export function f() {
13+
~
14+
!!! error TS4060: Return type of exported function has or is using private name 'X'.
1215
var x: X;
1316
return x;
1417
}

tests/baselines/reference/exportSpecifierForAGlobal.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,3 @@ function f() {
1919
return x;
2020
}
2121
exports.f = f;
22-
23-
24-
//// [b.d.ts]
25-
export { X };
26-
export declare function f(): X;

tests/baselines/reference/exportsAndImports3-amd.symbols

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ export enum E {
1515
>E : Symbol(E, Decl(t1.ts, 5, 1))
1616

1717
A, B, C
18-
>A : Symbol(E.A, Decl(t1.ts, 6, 15))
19-
>B : Symbol(E.B, Decl(t1.ts, 7, 6))
20-
>C : Symbol(E.C, Decl(t1.ts, 7, 9))
18+
>A : Symbol(E1.A, Decl(t1.ts, 6, 15))
19+
>B : Symbol(E1.B, Decl(t1.ts, 7, 6))
20+
>C : Symbol(E1.C, Decl(t1.ts, 7, 9))
2121
}
2222
export const enum D {
2323
>D : Symbol(D, Decl(t1.ts, 8, 1))
2424

2525
A, B, C
26-
>A : Symbol(D.A, Decl(t1.ts, 9, 21))
27-
>B : Symbol(D.B, Decl(t1.ts, 10, 6))
28-
>C : Symbol(D.C, Decl(t1.ts, 10, 9))
26+
>A : Symbol(D1.A, Decl(t1.ts, 9, 21))
27+
>B : Symbol(D1.B, Decl(t1.ts, 10, 6))
28+
>C : Symbol(D1.C, Decl(t1.ts, 10, 9))
2929
}
3030
export module M {
3131
>M : Symbol(M, Decl(t1.ts, 11, 1))

tests/baselines/reference/exportsAndImports3-es6.symbols

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ export enum E {
1515
>E : Symbol(E, Decl(t1.ts, 5, 1))
1616

1717
A, B, C
18-
>A : Symbol(E.A, Decl(t1.ts, 6, 15))
19-
>B : Symbol(E.B, Decl(t1.ts, 7, 6))
20-
>C : Symbol(E.C, Decl(t1.ts, 7, 9))
18+
>A : Symbol(E1.A, Decl(t1.ts, 6, 15))
19+
>B : Symbol(E1.B, Decl(t1.ts, 7, 6))
20+
>C : Symbol(E1.C, Decl(t1.ts, 7, 9))
2121
}
2222
export const enum D {
2323
>D : Symbol(D, Decl(t1.ts, 8, 1))
2424

2525
A, B, C
26-
>A : Symbol(D.A, Decl(t1.ts, 9, 21))
27-
>B : Symbol(D.B, Decl(t1.ts, 10, 6))
28-
>C : Symbol(D.C, Decl(t1.ts, 10, 9))
26+
>A : Symbol(D1.A, Decl(t1.ts, 9, 21))
27+
>B : Symbol(D1.B, Decl(t1.ts, 10, 6))
28+
>C : Symbol(D1.C, Decl(t1.ts, 10, 9))
2929
}
3030
export module M {
3131
>M : Symbol(M, Decl(t1.ts, 11, 1))

tests/baselines/reference/exportsAndImports3.symbols

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ export enum E {
1515
>E : Symbol(E, Decl(t1.ts, 5, 1))
1616

1717
A, B, C
18-
>A : Symbol(E.A, Decl(t1.ts, 6, 15))
19-
>B : Symbol(E.B, Decl(t1.ts, 7, 6))
20-
>C : Symbol(E.C, Decl(t1.ts, 7, 9))
18+
>A : Symbol(E1.A, Decl(t1.ts, 6, 15))
19+
>B : Symbol(E1.B, Decl(t1.ts, 7, 6))
20+
>C : Symbol(E1.C, Decl(t1.ts, 7, 9))
2121
}
2222
export const enum D {
2323
>D : Symbol(D, Decl(t1.ts, 8, 1))
2424

2525
A, B, C
26-
>A : Symbol(D.A, Decl(t1.ts, 9, 21))
27-
>B : Symbol(D.B, Decl(t1.ts, 10, 6))
28-
>C : Symbol(D.C, Decl(t1.ts, 10, 9))
26+
>A : Symbol(D1.A, Decl(t1.ts, 9, 21))
27+
>B : Symbol(D1.B, Decl(t1.ts, 10, 6))
28+
>C : Symbol(D1.C, Decl(t1.ts, 10, 9))
2929
}
3030
export module M {
3131
>M : Symbol(M, Decl(t1.ts, 11, 1))

tests/baselines/reference/systemModule15.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ use(moduleB.moduleC);
2323
use(moduleB.moduleCStar);
2424
>use(moduleB.moduleCStar) : void
2525
>use : (v: any) => void
26-
>moduleB.moduleCStar : typeof "tests/cases/compiler/file3"
26+
>moduleB.moduleCStar : typeof moduleB.moduleCStar
2727
>moduleB : typeof moduleB
28-
>moduleCStar : typeof "tests/cases/compiler/file3"
28+
>moduleCStar : typeof moduleB.moduleCStar
2929

3030
=== tests/cases/compiler/file2.ts ===
3131
import * as moduleCStar from "./file3"

0 commit comments

Comments
 (0)