Never elide an export * when --isolatedModules is set

This commit is contained in:
Andy Hanson
2017-05-02 14:11:46 -07:00
parent 1db4f96fd1
commit e696bbcd22
5 changed files with 37 additions and 1 deletions

View File

@@ -2922,7 +2922,7 @@ namespace ts {
function visitExportDeclaration(node: ExportDeclaration): VisitResult<Statement> {
if (!node.exportClause) {
// Elide a star export if the module it references does not export a value.
return resolver.moduleExportsSomeValue(node.moduleSpecifier) ? node : undefined;
return compilerOptions.isolatedModules || resolver.moduleExportsSomeValue(node.moduleSpecifier) ? node : undefined;
}
if (!resolver.isValueAliasDeclaration(node)) {

View File

@@ -0,0 +1,12 @@
//// [tests/cases/compiler/isolatedModulesDontElideReExportStar.ts] ////
//// [a.ts]
export type T = number;
//// [b.ts]
export * from "./a";
//// [a.js]
//// [b.js]
export * from "./a";

View File

@@ -0,0 +1,8 @@
=== /a.ts ===
export type T = number;
>T : Symbol(T, Decl(a.ts, 0, 0))
=== /b.ts ===
export * from "./a";
No type information for this code.
No type information for this code.

View File

@@ -0,0 +1,8 @@
=== /a.ts ===
export type T = number;
>T : number
=== /b.ts ===
export * from "./a";
No type information for this code.
No type information for this code.

View File

@@ -0,0 +1,8 @@
// @isolatedModules: true
// @target: es6
// @filename: /a.ts
export type T = number;
// @filename: /b.ts
export * from "./a";