| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c6fddba commit ceaeffa
17 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2161,7 +2161,6 @@ namespace ts { | |||
| 2161 | 2161 | return forEachEntry(symbols, symbolFromSymbolTable => { | |
| 2162 | 2162 | if (symbolFromSymbolTable.flags & SymbolFlags.Alias | |
| 2163 | 2163 | && symbolFromSymbolTable.escapedName !== "export=" | |
| 2164 | - && !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier) | ||
| 2165 | 2164 | && !(isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && isExternalModule(getSourceFileOfNode(enclosingDeclaration))) | |
| 2166 | 2165 | // If `!useOnlyExternalAliasing`, we can use any type of alias to get the name | |
| 2167 | 2166 | && (!useOnlyExternalAliasing || some(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration))) { | |
| Original file line number | Diff line number | Diff 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; | ||
| Original file line number | Diff line number | Diff 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 | + | ||
| Original file line number | Diff line number | Diff 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 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,8 +30,8 @@ export { c as c2 } from "server"; | |||
| 30 | 30 | ||
| 31 | 31 | export { i, m as instantiatedModule } from "server"; | |
| 32 | 32 | >i : any | |
| 33 | - >m : typeof m | ||
| 34 | - >instantiatedModule : typeof m | ||
| 33 | + >m : typeof instantiatedModule | ||
| 34 | + >instantiatedModule : typeof instantiatedModule | ||
| 35 | 35 | ||
| 36 | 36 | export { uninstantiated } from "server"; | |
| 37 | 37 | >uninstantiated : any | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,8 +30,8 @@ export { c as c2 } from "./server"; | |||
| 30 | 30 | ||
| 31 | 31 | export { i, m as instantiatedModule } from "./server"; | |
| 32 | 32 | >i : any | |
| 33 | - >m : typeof m | ||
| 34 | - >instantiatedModule : typeof m | ||
| 33 | + >m : typeof instantiatedModule | ||
| 34 | + >instantiatedModule : typeof instantiatedModule | ||
| 35 | 35 | ||
| 36 | 36 | export { uninstantiated } from "./server"; | |
| 37 | 37 | >uninstantiated : any | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,14 +1,17 @@ | |||
| 1 | 1 | 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'. | ||
| 2 | 3 | ||
| 3 | 4 | ||
| 4 | 5 | ==== tests/cases/compiler/a.d.ts (0 errors) ==== | |
| 5 | 6 | declare class X { } | |
| 6 | 7 | ||
| 7 | - ==== tests/cases/compiler/b.ts (1 errors) ==== | ||
| 8 | + ==== tests/cases/compiler/b.ts (2 errors) ==== | ||
| 8 | 9 | export {X}; | |
| 9 | 10 | ~ | |
| 10 | 11 | !!! error TS2661: Cannot export 'X'. Only local declarations can be exported from a module. | |
| 11 | 12 | export function f() { | |
| 13 | + ~ | ||
| 14 | + !!! error TS4060: Return type of exported function has or is using private name 'X'. | ||
| 12 | 15 | var x: X; | |
| 13 | 16 | return x; | |
| 14 | 17 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,8 +19,3 @@ function f() { | |||
| 19 | 19 | return x; | |
| 20 | 20 | } | |
| 21 | 21 | exports.f = f; | |
| 22 | - | ||
| 23 | - | ||
| 24 | - //// [b.d.ts] | ||
| 25 | - export { X }; | ||
| 26 | - export declare function f(): X; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,17 +15,17 @@ export enum E { | |||
| 15 | 15 | >E : Symbol(E, Decl(t1.ts, 5, 1)) | |
| 16 | 16 | ||
| 17 | 17 | 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)) | ||
| 21 | 21 | } | |
| 22 | 22 | export const enum D { | |
| 23 | 23 | >D : Symbol(D, Decl(t1.ts, 8, 1)) | |
| 24 | 24 | ||
| 25 | 25 | 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)) | ||
| 29 | 29 | } | |
| 30 | 30 | export module M { | |
| 31 | 31 | >M : Symbol(M, Decl(t1.ts, 11, 1)) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,17 +15,17 @@ export enum E { | |||
| 15 | 15 | >E : Symbol(E, Decl(t1.ts, 5, 1)) | |
| 16 | 16 | ||
| 17 | 17 | 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)) | ||
| 21 | 21 | } | |
| 22 | 22 | export const enum D { | |
| 23 | 23 | >D : Symbol(D, Decl(t1.ts, 8, 1)) | |
| 24 | 24 | ||
| 25 | 25 | 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)) | ||
| 29 | 29 | } | |
| 30 | 30 | export module M { | |
| 31 | 31 | >M : Symbol(M, Decl(t1.ts, 11, 1)) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments