Skip to content

Commit

Permalink
Elide re-exports of unresolved type-only imports (#56449)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbranch authored Nov 17, 2023
1 parent f07c0dd commit 4d34182
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47581,7 +47581,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
if (target === unknownSymbol) {
return true;
return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol);
}
// const enums and modules that contain only const enums are not considered values from the emit perspective
// unless 'preserveConstEnums' option is set to true
Expand Down
11 changes: 11 additions & 0 deletions src/testRunner/unittests/services/transpile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -662,4 +662,15 @@ export * as alias from './file';`,
testVerbatimModuleSyntax: true,
},
);

transpilesCorrectly(
"Elides re-export of type-only import",
`
import type { Foo } from "./types";
export { Foo };
`,
{
options: { compilerOptions: { module: ts.ModuleKind.ESNext, target: ts.ScriptTarget.ESNext } },
},
);
});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4d34182

Please # to comment.