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(PackageJson): ensure Imports and Exports reflect Node.js expectations #555

Merged
merged 1 commit into from Feb 17, 2023

Conversation

Xunnamius
Copy link
Contributor

Seems my previous PR was incomplete. While reviewing the Node.js source, I noticed a couple more issues. Namely: the Imports and Exports types should both accept fallback arrays containing exports conditions objects with optional properties. Also, the Imports type should accept everything the Exports type accepts (with the added constraint that entry points must start with "#").

This PR addresses these and adds tests.

@sindresorhus sindresorhus merged commit 3ebab0d into sindresorhus:main Feb 17, 2023
/**
A mapping of conditions and the paths to which they resolve.
*/
type ExportConditions = {[condition in ExportCondition]?: Exports};
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ? here introduces undefined as a valid exports value in the type, which is not possible by JSON.

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.

None yet

3 participants