Skip to content

Commit

Permalink
fix(declarations): fix TypeScript backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
wessberg committed Apr 14, 2021
1 parent 9c09915 commit 4f09009
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Expand Up @@ -6,8 +6,9 @@ export function visitExportDeclaration(options: NoExportDeclarationTransformerVi
if (preserveExportsWithModuleSpecifiers && node.moduleSpecifier != null) {
return node;
}
const isNamespaceExport = typescript.isNamespaceExport == null ? () => false : typescript.isNamespaceExport;

if (preserveAliasedExports && node.exportClause != null && (typescript.isNamespaceExport(node.exportClause) || node.exportClause.elements.some(element => element.propertyName != null))) {
if (preserveAliasedExports && node.exportClause != null && (isNamespaceExport(node.exportClause) || node.exportClause.elements.some(element => element.propertyName != null))) {
return node;
}

Expand Down
2 changes: 1 addition & 1 deletion test/declaration.test.ts
Expand Up @@ -631,7 +631,7 @@ test.serial("Flattens declarations. #15", withTypeScriptVersions(">=3.5"), async
);
});

test.serial("Flattens declarations. #16", withTypeScript, async (t, {typescript}) => {
test("Flattens declarations. #16", withTypeScript, async (t, {typescript}) => {
const bundle = await generateRollupBundle(
[
{
Expand Down

0 comments on commit 4f09009

Please sign in to comment.