Skip to content

Fix default and named type-only imports - #58

Open
mayankdhingra02 wants to merge 1 commit into
poppinss:7.xfrom
mayankdhingra02:fix-default-type-imports
Open

mayankdhingra02 wants to merge 1 commit into
poppinss:7.xfrom
mayankdhingra02:fix-default-type-imports

Conversation

@mayankdhingra02

Copy link
Copy Markdown

🔗 Linked issue

Fixes #57

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

ImportsBag currently emits import type Default, { Named } from 'package' when a source has both kinds of type imports. TypeScript rejects this with TS1363. Emit separate default and named type declarations while keeping value imports and deduplication unchanged.

Correct the combined-output expectation and check generated imports with the TypeScript compiler, including both merge orders, aliases and mixed value/type imports.

Validation: npm test (212 passing), npm run typecheck and npm run build pass on Node 24.22.1 and 26.12.1 on macOS. Formatting and lint also pass. Linux and Windows CI were not run locally. The lodash build reports that Java's Closure Compiler is unavailable and completes with UglifyJS.

📝 Checklist

  • I have read the contribution guide.
  • I have linked an issue or discussion.
  • I have updated the documentation accordingly. (No public API change.)

Signed-off-by: Mayank Dhingra <mayankdhingra02@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ImportsBag generates a type-only import rejected by TypeScript

1 participant