diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 29720ff8532..70c7f428951 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2748,7 +2748,11 @@ namespace ts { && symbolFromSymbolTable.escapedName !== InternalSymbolName.Default && !(isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && isExternalModule(getSourceFileOfNode(enclosingDeclaration))) // If `!useOnlyExternalAliasing`, we can use any type of alias to get the name - && (!useOnlyExternalAliasing || some(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration))) { + && (!useOnlyExternalAliasing || some(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) + // While exports are generally considered to be in scope, export-specifier declared symbols are _not_ + // See similar comment in `resolveName` for details + && (ignoreQualification || !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)) + ) { const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) { diff --git a/tests/baselines/reference/declarationEmitExportAliasVisibiilityMarking.js b/tests/baselines/reference/declarationEmitExportAliasVisibiilityMarking.js new file mode 100644 index 00000000000..fcc0722c07e --- /dev/null +++ b/tests/baselines/reference/declarationEmitExportAliasVisibiilityMarking.js @@ -0,0 +1,46 @@ +//// [tests/cases/compiler/declarationEmitExportAliasVisibiilityMarking.ts] //// + +//// [Types.ts] +type Suit = 'Hearts' | 'Spades' | 'Clubs' | 'Diamonds'; +type Rank = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 'Jack' | 'Queen' | 'King'; +export { Suit, Rank }; + +//// [Card.ts] +import { Suit, Rank } from './Types'; +export default (suit: Suit, rank: Rank) => ({suit, rank}); + +//// [index.ts] +export let lazyCard = () => import('./Card').then(a => a.default); +export { Suit, Rank } from './Types'; + + +//// [Types.js] +"use strict"; +exports.__esModule = true; +//// [Card.js] +"use strict"; +exports.__esModule = true; +exports["default"] = (function (suit, rank) { return ({ suit: suit, rank: rank }); }); +//// [index.js] +"use strict"; +exports.__esModule = true; +exports.lazyCard = function () { return Promise.resolve().then(function () { return require('./Card'); }).then(function (a) { return a["default"]; }); }; + + +//// [Types.d.ts] +declare type Suit = 'Hearts' | 'Spades' | 'Clubs' | 'Diamonds'; +declare type Rank = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 'Jack' | 'Queen' | 'King'; +export { Suit, Rank }; +//// [Card.d.ts] +import { Suit, Rank } from './Types'; +declare const _default: (suit: Suit, rank: Rank) => { + suit: Suit; + rank: Rank; +}; +export default _default; +//// [index.d.ts] +export declare let lazyCard: () => Promise<(suit: import("./Types").Suit, rank: import("./Types").Rank) => { + suit: import("./Types").Suit; + rank: import("./Types").Rank; +}>; +export { Suit, Rank } from './Types'; diff --git a/tests/baselines/reference/declarationEmitExportAliasVisibiilityMarking.symbols b/tests/baselines/reference/declarationEmitExportAliasVisibiilityMarking.symbols new file mode 100644 index 00000000000..a89d82fff50 --- /dev/null +++ b/tests/baselines/reference/declarationEmitExportAliasVisibiilityMarking.symbols @@ -0,0 +1,39 @@ +=== tests/cases/compiler/Types.ts === +type Suit = 'Hearts' | 'Spades' | 'Clubs' | 'Diamonds'; +>Suit : Symbol(Suit, Decl(Types.ts, 0, 0)) + +type Rank = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 'Jack' | 'Queen' | 'King'; +>Rank : Symbol(Rank, Decl(Types.ts, 0, 55)) + +export { Suit, Rank }; +>Suit : Symbol(Suit, Decl(Types.ts, 2, 8)) +>Rank : Symbol(Rank, Decl(Types.ts, 2, 14)) + +=== tests/cases/compiler/Card.ts === +import { Suit, Rank } from './Types'; +>Suit : Symbol(Suit, Decl(Card.ts, 0, 8)) +>Rank : Symbol(Rank, Decl(Card.ts, 0, 14)) + +export default (suit: Suit, rank: Rank) => ({suit, rank}); +>suit : Symbol(suit, Decl(Card.ts, 1, 16)) +>Suit : Symbol(Suit, Decl(Card.ts, 0, 8)) +>rank : Symbol(rank, Decl(Card.ts, 1, 27)) +>Rank : Symbol(Rank, Decl(Card.ts, 0, 14)) +>suit : Symbol(suit, Decl(Card.ts, 1, 45)) +>rank : Symbol(rank, Decl(Card.ts, 1, 50)) + +=== tests/cases/compiler/index.ts === +export let lazyCard = () => import('./Card').then(a => a.default); +>lazyCard : Symbol(lazyCard, Decl(index.ts, 0, 10)) +>import('./Card').then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>'./Card' : Symbol("tests/cases/compiler/Card", Decl(Card.ts, 0, 0)) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>a : Symbol(a, Decl(index.ts, 0, 50)) +>a.default : Symbol(default, Decl(Card.ts, 0, 37)) +>a : Symbol(a, Decl(index.ts, 0, 50)) +>default : Symbol(default, Decl(Card.ts, 0, 37)) + +export { Suit, Rank } from './Types'; +>Suit : Symbol(Suit, Decl(index.ts, 1, 8)) +>Rank : Symbol(Rank, Decl(index.ts, 1, 14)) + diff --git a/tests/baselines/reference/declarationEmitExportAliasVisibiilityMarking.types b/tests/baselines/reference/declarationEmitExportAliasVisibiilityMarking.types new file mode 100644 index 00000000000..bf9666f3082 --- /dev/null +++ b/tests/baselines/reference/declarationEmitExportAliasVisibiilityMarking.types @@ -0,0 +1,44 @@ +=== tests/cases/compiler/Types.ts === +type Suit = 'Hearts' | 'Spades' | 'Clubs' | 'Diamonds'; +>Suit : Suit + +type Rank = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 'Jack' | 'Queen' | 'King'; +>Rank : Rank + +export { Suit, Rank }; +>Suit : any +>Rank : any + +=== tests/cases/compiler/Card.ts === +import { Suit, Rank } from './Types'; +>Suit : any +>Rank : any + +export default (suit: Suit, rank: Rank) => ({suit, rank}); +>(suit: Suit, rank: Rank) => ({suit, rank}) : (suit: Suit, rank: Rank) => { suit: Suit; rank: Rank; } +>suit : Suit +>rank : Rank +>({suit, rank}) : { suit: Suit; rank: Rank; } +>{suit, rank} : { suit: Suit; rank: Rank; } +>suit : Suit +>rank : Rank + +=== tests/cases/compiler/index.ts === +export let lazyCard = () => import('./Card').then(a => a.default); +>lazyCard : () => Promise<(suit: import("tests/cases/compiler/Types").Suit, rank: import("tests/cases/compiler/Types").Rank) => { suit: import("tests/cases/compiler/Types").Suit; rank: import("tests/cases/compiler/Types").Rank; }> +>() => import('./Card').then(a => a.default) : () => Promise<(suit: import("tests/cases/compiler/Types").Suit, rank: import("tests/cases/compiler/Types").Rank) => { suit: import("tests/cases/compiler/Types").Suit; rank: import("tests/cases/compiler/Types").Rank; }> +>import('./Card').then(a => a.default) : Promise<(suit: import("tests/cases/compiler/Types").Suit, rank: import("tests/cases/compiler/Types").Rank) => { suit: import("tests/cases/compiler/Types").Suit; rank: import("tests/cases/compiler/Types").Rank; }> +>import('./Card').then : (onfulfilled?: (value: typeof import("tests/cases/compiler/Card")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>import('./Card') : Promise +>'./Card' : "./Card" +>then : (onfulfilled?: (value: typeof import("tests/cases/compiler/Card")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>a => a.default : (a: typeof import("tests/cases/compiler/Card")) => (suit: import("tests/cases/compiler/Types").Suit, rank: import("tests/cases/compiler/Types").Rank) => { suit: import("tests/cases/compiler/Types").Suit; rank: import("tests/cases/compiler/Types").Rank; } +>a : typeof import("tests/cases/compiler/Card") +>a.default : (suit: import("tests/cases/compiler/Types").Suit, rank: import("tests/cases/compiler/Types").Rank) => { suit: import("tests/cases/compiler/Types").Suit; rank: import("tests/cases/compiler/Types").Rank; } +>a : typeof import("tests/cases/compiler/Card") +>default : (suit: import("tests/cases/compiler/Types").Suit, rank: import("tests/cases/compiler/Types").Rank) => { suit: import("tests/cases/compiler/Types").Suit; rank: import("tests/cases/compiler/Types").Rank; } + +export { Suit, Rank } from './Types'; +>Suit : any +>Rank : any + diff --git a/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifier.types b/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifier.types index 532931fd2b3..523f0673025 100644 --- a/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifier.types +++ b/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifier.types @@ -20,16 +20,16 @@ export module uninstantiated { === tests/cases/compiler/client.ts === export { c } from "server"; ->c : typeof c +>c : typeof import("tests/cases/compiler/server").c export { c as c2 } from "server"; ->c : typeof c ->c2 : typeof c +>c : typeof import("tests/cases/compiler/server").c +>c2 : typeof import("tests/cases/compiler/server").c export { i, m as instantiatedModule } from "server"; >i : any ->m : typeof instantiatedModule ->instantiatedModule : typeof instantiatedModule +>m : typeof import("tests/cases/compiler/server").m +>instantiatedModule : typeof import("tests/cases/compiler/server").m export { uninstantiated } from "server"; >uninstantiated : any diff --git a/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.types b/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.types index 57b4845a6fa..cb5fd1d3756 100644 --- a/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.types +++ b/tests/baselines/reference/es6ExportClauseWithoutModuleSpecifierInEs5.types @@ -20,16 +20,16 @@ export module uninstantiated { === tests/cases/compiler/client.ts === export { c } from "./server"; ->c : typeof c +>c : typeof import("tests/cases/compiler/server").c export { c as c2 } from "./server"; ->c : typeof c ->c2 : typeof c +>c : typeof import("tests/cases/compiler/server").c +>c2 : typeof import("tests/cases/compiler/server").c export { i, m as instantiatedModule } from "./server"; >i : any ->m : typeof instantiatedModule ->instantiatedModule : typeof instantiatedModule +>m : typeof import("tests/cases/compiler/server").m +>instantiatedModule : typeof import("tests/cases/compiler/server").m export { uninstantiated } from "./server"; >uninstantiated : any diff --git a/tests/baselines/reference/exportSpecifierForAGlobal.errors.txt b/tests/baselines/reference/exportSpecifierForAGlobal.errors.txt index 20a1c9a7d41..d2f103a91fa 100644 --- a/tests/baselines/reference/exportSpecifierForAGlobal.errors.txt +++ b/tests/baselines/reference/exportSpecifierForAGlobal.errors.txt @@ -1,17 +1,14 @@ tests/cases/compiler/b.ts(1,9): error TS2661: Cannot export 'X'. Only local declarations can be exported from a module. -tests/cases/compiler/b.ts(2,17): error TS4060: Return type of exported function has or is using private name 'X'. ==== tests/cases/compiler/a.d.ts (0 errors) ==== declare class X { } -==== tests/cases/compiler/b.ts (2 errors) ==== +==== tests/cases/compiler/b.ts (1 errors) ==== export {X}; ~ !!! error TS2661: Cannot export 'X'. Only local declarations can be exported from a module. export function f() { - ~ -!!! error TS4060: Return type of exported function has or is using private name 'X'. var x: X; return x; } diff --git a/tests/baselines/reference/exportSpecifierForAGlobal.js b/tests/baselines/reference/exportSpecifierForAGlobal.js index 9f12241cbd1..6023b7c7f14 100644 --- a/tests/baselines/reference/exportSpecifierForAGlobal.js +++ b/tests/baselines/reference/exportSpecifierForAGlobal.js @@ -19,3 +19,8 @@ function f() { return x; } exports.f = f; + + +//// [b.d.ts] +export { X }; +export declare function f(): X; diff --git a/tests/baselines/reference/exportsAndImports1-amd.types b/tests/baselines/reference/exportsAndImports1-amd.types index b63913106fa..fc79a3dcc78 100644 --- a/tests/baselines/reference/exportsAndImports1-amd.types +++ b/tests/baselines/reference/exportsAndImports1-amd.types @@ -61,11 +61,11 @@ export { v, f, C, I, E, D, M, N, T, a }; export { v, f, C, I, E, D, M, N, T, a } from "./t1"; >v : number >f : () => void ->C : typeof C +>C : typeof import("tests/cases/conformance/es6/modules/t1").C >I : any ->E : typeof E ->D : typeof D ->M : typeof M +>E : typeof import("tests/cases/conformance/es6/modules/t1").E +>D : typeof import("tests/cases/conformance/es6/modules/t1").D +>M : typeof import("tests/cases/conformance/es6/modules/t1").M >N : any >T : any >a : any diff --git a/tests/baselines/reference/exportsAndImports1-es6.types b/tests/baselines/reference/exportsAndImports1-es6.types index b63913106fa..fc79a3dcc78 100644 --- a/tests/baselines/reference/exportsAndImports1-es6.types +++ b/tests/baselines/reference/exportsAndImports1-es6.types @@ -61,11 +61,11 @@ export { v, f, C, I, E, D, M, N, T, a }; export { v, f, C, I, E, D, M, N, T, a } from "./t1"; >v : number >f : () => void ->C : typeof C +>C : typeof import("tests/cases/conformance/es6/modules/t1").C >I : any ->E : typeof E ->D : typeof D ->M : typeof M +>E : typeof import("tests/cases/conformance/es6/modules/t1").E +>D : typeof import("tests/cases/conformance/es6/modules/t1").D +>M : typeof import("tests/cases/conformance/es6/modules/t1").M >N : any >T : any >a : any diff --git a/tests/baselines/reference/exportsAndImports1.types b/tests/baselines/reference/exportsAndImports1.types index b63913106fa..fc79a3dcc78 100644 --- a/tests/baselines/reference/exportsAndImports1.types +++ b/tests/baselines/reference/exportsAndImports1.types @@ -61,11 +61,11 @@ export { v, f, C, I, E, D, M, N, T, a }; export { v, f, C, I, E, D, M, N, T, a } from "./t1"; >v : number >f : () => void ->C : typeof C +>C : typeof import("tests/cases/conformance/es6/modules/t1").C >I : any ->E : typeof E ->D : typeof D ->M : typeof M +>E : typeof import("tests/cases/conformance/es6/modules/t1").E +>D : typeof import("tests/cases/conformance/es6/modules/t1").D +>M : typeof import("tests/cases/conformance/es6/modules/t1").M >N : any >T : any >a : any diff --git a/tests/baselines/reference/exportsAndImports3-amd.symbols b/tests/baselines/reference/exportsAndImports3-amd.symbols index edc5d5c2e4e..f71014281c2 100644 --- a/tests/baselines/reference/exportsAndImports3-amd.symbols +++ b/tests/baselines/reference/exportsAndImports3-amd.symbols @@ -15,17 +15,17 @@ export enum E { >E : Symbol(E, Decl(t1.ts, 5, 1)) A, B, C ->A : Symbol(E1.A, Decl(t1.ts, 6, 15)) ->B : Symbol(E1.B, Decl(t1.ts, 7, 6)) ->C : Symbol(E1.C, Decl(t1.ts, 7, 9)) +>A : Symbol(E.A, Decl(t1.ts, 6, 15)) +>B : Symbol(E.B, Decl(t1.ts, 7, 6)) +>C : Symbol(E.C, Decl(t1.ts, 7, 9)) } export const enum D { >D : Symbol(D, Decl(t1.ts, 8, 1)) A, B, C ->A : Symbol(D1.A, Decl(t1.ts, 9, 21)) ->B : Symbol(D1.B, Decl(t1.ts, 10, 6)) ->C : Symbol(D1.C, Decl(t1.ts, 10, 9)) +>A : Symbol(D.A, Decl(t1.ts, 9, 21)) +>B : Symbol(D.B, Decl(t1.ts, 10, 6)) +>C : Symbol(D.C, Decl(t1.ts, 10, 9)) } export module M { >M : Symbol(M, Decl(t1.ts, 11, 1)) diff --git a/tests/baselines/reference/exportsAndImports3-amd.types b/tests/baselines/reference/exportsAndImports3-amd.types index a8357a4db22..8a021f7a009 100644 --- a/tests/baselines/reference/exportsAndImports3-amd.types +++ b/tests/baselines/reference/exportsAndImports3-amd.types @@ -73,16 +73,16 @@ export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, >v : number >f1 : () => void >f : () => void ->C1 : typeof C ->C : typeof C +>C1 : typeof import("tests/cases/conformance/es6/modules/t1").C +>C : typeof import("tests/cases/conformance/es6/modules/t1").C >I1 : any >I : any ->E1 : typeof E ->E : typeof E ->D1 : typeof D ->D : typeof D ->M1 : typeof M ->M : typeof M +>E1 : typeof import("tests/cases/conformance/es6/modules/t1").E +>E : typeof import("tests/cases/conformance/es6/modules/t1").E +>D1 : typeof import("tests/cases/conformance/es6/modules/t1").D +>D : typeof import("tests/cases/conformance/es6/modules/t1").D +>M1 : typeof import("tests/cases/conformance/es6/modules/t1").M +>M : typeof import("tests/cases/conformance/es6/modules/t1").M >N1 : any >N : any >T1 : any diff --git a/tests/baselines/reference/exportsAndImports3-es6.symbols b/tests/baselines/reference/exportsAndImports3-es6.symbols index edc5d5c2e4e..f71014281c2 100644 --- a/tests/baselines/reference/exportsAndImports3-es6.symbols +++ b/tests/baselines/reference/exportsAndImports3-es6.symbols @@ -15,17 +15,17 @@ export enum E { >E : Symbol(E, Decl(t1.ts, 5, 1)) A, B, C ->A : Symbol(E1.A, Decl(t1.ts, 6, 15)) ->B : Symbol(E1.B, Decl(t1.ts, 7, 6)) ->C : Symbol(E1.C, Decl(t1.ts, 7, 9)) +>A : Symbol(E.A, Decl(t1.ts, 6, 15)) +>B : Symbol(E.B, Decl(t1.ts, 7, 6)) +>C : Symbol(E.C, Decl(t1.ts, 7, 9)) } export const enum D { >D : Symbol(D, Decl(t1.ts, 8, 1)) A, B, C ->A : Symbol(D1.A, Decl(t1.ts, 9, 21)) ->B : Symbol(D1.B, Decl(t1.ts, 10, 6)) ->C : Symbol(D1.C, Decl(t1.ts, 10, 9)) +>A : Symbol(D.A, Decl(t1.ts, 9, 21)) +>B : Symbol(D.B, Decl(t1.ts, 10, 6)) +>C : Symbol(D.C, Decl(t1.ts, 10, 9)) } export module M { >M : Symbol(M, Decl(t1.ts, 11, 1)) diff --git a/tests/baselines/reference/exportsAndImports3-es6.types b/tests/baselines/reference/exportsAndImports3-es6.types index a8357a4db22..8a021f7a009 100644 --- a/tests/baselines/reference/exportsAndImports3-es6.types +++ b/tests/baselines/reference/exportsAndImports3-es6.types @@ -73,16 +73,16 @@ export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, >v : number >f1 : () => void >f : () => void ->C1 : typeof C ->C : typeof C +>C1 : typeof import("tests/cases/conformance/es6/modules/t1").C +>C : typeof import("tests/cases/conformance/es6/modules/t1").C >I1 : any >I : any ->E1 : typeof E ->E : typeof E ->D1 : typeof D ->D : typeof D ->M1 : typeof M ->M : typeof M +>E1 : typeof import("tests/cases/conformance/es6/modules/t1").E +>E : typeof import("tests/cases/conformance/es6/modules/t1").E +>D1 : typeof import("tests/cases/conformance/es6/modules/t1").D +>D : typeof import("tests/cases/conformance/es6/modules/t1").D +>M1 : typeof import("tests/cases/conformance/es6/modules/t1").M +>M : typeof import("tests/cases/conformance/es6/modules/t1").M >N1 : any >N : any >T1 : any diff --git a/tests/baselines/reference/exportsAndImports3.symbols b/tests/baselines/reference/exportsAndImports3.symbols index edc5d5c2e4e..f71014281c2 100644 --- a/tests/baselines/reference/exportsAndImports3.symbols +++ b/tests/baselines/reference/exportsAndImports3.symbols @@ -15,17 +15,17 @@ export enum E { >E : Symbol(E, Decl(t1.ts, 5, 1)) A, B, C ->A : Symbol(E1.A, Decl(t1.ts, 6, 15)) ->B : Symbol(E1.B, Decl(t1.ts, 7, 6)) ->C : Symbol(E1.C, Decl(t1.ts, 7, 9)) +>A : Symbol(E.A, Decl(t1.ts, 6, 15)) +>B : Symbol(E.B, Decl(t1.ts, 7, 6)) +>C : Symbol(E.C, Decl(t1.ts, 7, 9)) } export const enum D { >D : Symbol(D, Decl(t1.ts, 8, 1)) A, B, C ->A : Symbol(D1.A, Decl(t1.ts, 9, 21)) ->B : Symbol(D1.B, Decl(t1.ts, 10, 6)) ->C : Symbol(D1.C, Decl(t1.ts, 10, 9)) +>A : Symbol(D.A, Decl(t1.ts, 9, 21)) +>B : Symbol(D.B, Decl(t1.ts, 10, 6)) +>C : Symbol(D.C, Decl(t1.ts, 10, 9)) } export module M { >M : Symbol(M, Decl(t1.ts, 11, 1)) diff --git a/tests/baselines/reference/exportsAndImports3.types b/tests/baselines/reference/exportsAndImports3.types index a8357a4db22..8a021f7a009 100644 --- a/tests/baselines/reference/exportsAndImports3.types +++ b/tests/baselines/reference/exportsAndImports3.types @@ -73,16 +73,16 @@ export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, >v : number >f1 : () => void >f : () => void ->C1 : typeof C ->C : typeof C +>C1 : typeof import("tests/cases/conformance/es6/modules/t1").C +>C : typeof import("tests/cases/conformance/es6/modules/t1").C >I1 : any >I : any ->E1 : typeof E ->E : typeof E ->D1 : typeof D ->D : typeof D ->M1 : typeof M ->M : typeof M +>E1 : typeof import("tests/cases/conformance/es6/modules/t1").E +>E : typeof import("tests/cases/conformance/es6/modules/t1").E +>D1 : typeof import("tests/cases/conformance/es6/modules/t1").D +>D : typeof import("tests/cases/conformance/es6/modules/t1").D +>M1 : typeof import("tests/cases/conformance/es6/modules/t1").M +>M : typeof import("tests/cases/conformance/es6/modules/t1").M >N1 : any >N : any >T1 : any diff --git a/tests/baselines/reference/isolatedModulesReExportType.types b/tests/baselines/reference/isolatedModulesReExportType.types index 5c857a16952..55c4cdfb7b7 100644 --- a/tests/baselines/reference/isolatedModulesReExportType.types +++ b/tests/baselines/reference/isolatedModulesReExportType.types @@ -8,7 +8,7 @@ export import T2 = require("./exportEqualsT"); // OK, has a value side export { C } from "./exportValue"; ->C : typeof C +>C : typeof import("/exportValue").C // OK, even though the namespace it exports is only types. import * as NS from "./exportT"; diff --git a/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.types b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.types index 1e1f0be5101..fbcc5fa6c43 100644 --- a/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.types +++ b/tests/baselines/reference/moduleSameValueDuplicateExportedBindings2.types @@ -4,7 +4,7 @@ No type information for this code.export * from "./c"; No type information for this code. No type information for this code.=== tests/cases/compiler/b.ts === export {Animals} from "./c"; ->Animals : typeof Animals +>Animals : typeof import("tests/cases/compiler/c").Animals === tests/cases/compiler/c.ts === export enum Animals { diff --git a/tests/baselines/reference/reexportWrittenCorrectlyInDeclaration.types b/tests/baselines/reference/reexportWrittenCorrectlyInDeclaration.types index 37204b21d09..8d84e2a9d35 100644 --- a/tests/baselines/reference/reexportWrittenCorrectlyInDeclaration.types +++ b/tests/baselines/reference/reexportWrittenCorrectlyInDeclaration.types @@ -9,10 +9,10 @@ export class ThingB { } === tests/cases/compiler/Things.ts === export {ThingA} from "./ThingA"; ->ThingA : typeof ThingA +>ThingA : typeof import("tests/cases/compiler/ThingA").ThingA export {ThingB} from "./ThingB"; ->ThingB : typeof ThingB +>ThingB : typeof import("tests/cases/compiler/ThingB").ThingB === tests/cases/compiler/Test.ts === import * as things from "./Things"; diff --git a/tests/baselines/reference/systemNamespaceAliasEmit.symbols b/tests/baselines/reference/systemNamespaceAliasEmit.symbols index 89ac66a624d..7e9c2434586 100644 --- a/tests/baselines/reference/systemNamespaceAliasEmit.symbols +++ b/tests/baselines/reference/systemNamespaceAliasEmit.symbols @@ -10,10 +10,10 @@ enum AnEnum { >AnEnum : Symbol(AnEnum, Decl(systemNamespaceAliasEmit.ts, 2, 1)) ONE, ->ONE : Symbol(BarEnum.ONE, Decl(systemNamespaceAliasEmit.ts, 4, 13)) +>ONE : Symbol(AnEnum.ONE, Decl(systemNamespaceAliasEmit.ts, 4, 13)) TWO ->TWO : Symbol(BarEnum.TWO, Decl(systemNamespaceAliasEmit.ts, 5, 8)) +>TWO : Symbol(AnEnum.TWO, Decl(systemNamespaceAliasEmit.ts, 5, 8)) } export {ns, AnEnum, ns as FooBar, AnEnum as BarEnum}; diff --git a/tests/cases/compiler/declarationEmitExportAliasVisibiilityMarking.ts b/tests/cases/compiler/declarationEmitExportAliasVisibiilityMarking.ts new file mode 100644 index 00000000000..666ea9c2eda --- /dev/null +++ b/tests/cases/compiler/declarationEmitExportAliasVisibiilityMarking.ts @@ -0,0 +1,14 @@ +// @lib: es2015 +// @declaration: true +// @filename: Types.ts +type Suit = 'Hearts' | 'Spades' | 'Clubs' | 'Diamonds'; +type Rank = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 'Jack' | 'Queen' | 'King'; +export { Suit, Rank }; + +// @filename: Card.ts +import { Suit, Rank } from './Types'; +export default (suit: Suit, rank: Rank) => ({suit, rank}); + +// @filename: index.ts +export let lazyCard = () => import('./Card').then(a => a.default); +export { Suit, Rank } from './Types';