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(types): Update package.json exports to support TypeScript 4.7 #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yoginderkumar
Copy link

PR Description:

This pull request addresses the changes introduced in TypeScript 4.7 regarding the handling of package.json exports and imports. The TypeScript team has improved the way types are resolved when using the exports field in package.json, which requires updates to our codebase to ensure compatibility.

Changes:

  • Updated the exports field in package.json to include the types entry, allowing TypeScript to correctly resolve the types when importing the library.
  • Moved the types field to be within the exports object, aligning with the recommended structure in TypeScript 4.7.

Reference:

Before:

"exports": {
  "default": "./empty.js",
  "import": "./empty.js"
},
"main": "./empty.js",
"types": "./index.d.ts"

After:

"exports": {
  "types": "./index.d.ts",
  "default": "./empty.js",
  "import": "./empty.js"
},
"main": "./empty.js"

By making these changes, we ensure compatibility with TypeScript 4.7 and future versions, providing a smoother development experience and preventing potential issues related to type resolution.

@kripod
Copy link
Owner

kripod commented Apr 4, 2024

Thanks for your contribution!

Unfortunately, though, I’m not maintaining this project anymore as recent improvements in @types/react made it feasible to roll your own implementation: https://www.kripod.dev/blog/behind-the-as-prop-polymorphism-done-well/

Please feel free to fork the codebase if you want to.

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.

2 participants