Skip to content

Commit

Permalink
Fix unnecessary aliasing (#13)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Candeia <[email protected]>
  • Loading branch information
mcandeia authored Sep 17, 2024
1 parent e404c16 commit 3c2ba2f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/codemod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,13 @@ export const rewriteImport = (
}
const namedImports = newImports[newModuleSpecifier].namedImports;
if (Array.isArray(namedImports)) {
// this avoids breaking change when referencing the same symbol multiple times
const nameAsAlias = typeof rewriter.name !== "undefined"
? name
: undefined;
namedImports.push({
name: rewriter.name ?? name,
alias: alias ?? name,
alias: alias ?? nameAsAlias,
isTypeOnly: newIsTypeOnly ?? isTypeOnly,
});
}
Expand Down

0 comments on commit 3c2ba2f

Please sign in to comment.