Skip to content

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