-
Notifications
You must be signed in to change notification settings - Fork 13.1k
package.json exports should have priority over typesVersions
#50890
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
package.json exports should have priority over typesVersions
#50890
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a types@>=4 condition or the like would be useful as a test alongside the typesVersions object, too, if you're up for adding another test case.
|
This probably needs a big call out in the docs in the |
|
How's this for the release notes?
|
|
q: shouldn't the presented diff only add the |
|
The presence of |
Is how you should shape that export object, to accommodate types for a |
package.json
exportsis a superset of the features supported bytypesVersions, but currentlytypesVersionsis consulted first. This prevents TypeScript from recognizing theexportsfor a path that also matches atypesVersionspath, which is a big problem if the package wants to use conditional exports that benefit--moduleResolution nodenextandtypesVersionsfor--moduleResolution node. As far as I can tell, this was just an oversight, as no existing tests broke when I changed the order.Thanks to @fictitious for noticing at andrewbranch/example-subpath-exports-ts-compat#1