Skip to content
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

Fix ESM type import in Webpack loader #2452

Merged
merged 1 commit into from Mar 6, 2024
Merged

Fix ESM type import in Webpack loader #2452

merged 1 commit into from Mar 6, 2024

Conversation

remcohaszing
Copy link
Member

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

TypeScript 5.3 introduced support for import attributes and resolution-mode. This can be used to import types from ESM files into CJS files without a @ts-ignore comment.

The @ts-ignore comment is stripped from generated type definitions, which leads to a type error for consumers. The module resolution mode is not, which fixes it for users using TypeScript 5.3 or greater.

TypeScript 5.3 introduced support for import attributes and
`resolution-mode`. This can be used to import types from ESM files into
CJS files without a `@ts-ignore` comment.
@remcohaszing remcohaszing added 🐛 type/bug This is a problem 🗄 area/interface This affects the public interface ☂️ area/types This affects typings 👶 semver/patch This is a backwards-compatible fix 🤞 phase/open Post is being triaged manually labels Mar 5, 2024
Copy link

vercel bot commented Mar 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
mdx ✅ Ready (Inspect) Visit Preview Mar 5, 2024 1:27pm

@wooorm wooorm changed the title Fix ESM type import in Webpack loader CJS file Fix ESM type import in Webpack loader Mar 6, 2024
@wooorm wooorm merged commit 3a794ab into main Mar 6, 2024
10 checks passed
@wooorm wooorm deleted the fix-esm-type-import branch March 6, 2024 15:31
@wooorm wooorm added 💪 phase/solved Post is done and removed 🤞 phase/open Post is being triaged manually labels Mar 6, 2024
@wooorm
Copy link
Member

wooorm commented Mar 6, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗄 area/interface This affects the public interface ☂️ area/types This affects typings 💪 phase/solved Post is done 👶 semver/patch This is a backwards-compatible fix 🐛 type/bug This is a problem
Development

Successfully merging this pull request may close these issues.

None yet

3 participants