Skip to content

Never elide an export * when --isolatedModules is set #15539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
1 commit merged into from
May 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/transformers/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
12 changes: 12 additions & 0 deletions tests/baselines/reference/isolatedModulesDontElideReExportStar.js
Original file line number Diff line number Diff line change
@@ -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";
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 8 additions & 0 deletions tests/cases/compiler/isolatedModulesDontElideReExportStar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @isolatedModules: true
// @target: es6

// @filename: /a.ts
export type T = number;

// @filename: /b.ts
export * from "./a";