-
Notifications
You must be signed in to change notification settings - Fork 30
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: get exports working in TS nodeNext
#796
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Now that this field is here,
tsup
automatically detects that and flips the extensions so now thedist/
directory looks like this:.js
/.d.ts
= ESM.cjs
/.d.cts
= CJSThere 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.
Correct me if im wrong but now the package is a full esm package
The correct way to fix it would be
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.
One more example, storybookjs/storybook#19269 (comment)
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.
And this tool can be used to check it https://github.com/arethetypeswrong/arethetypeswrong.github.io
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.
@prisis that tool is fantastic, thanks for sharing!
We don't need to explicitly define the type declaration files since TS will automatically pick up on the co-located files (see here for more info). This PR was published to
oas@21.1
and it appears that the types are being picked up by that website properly:Yeah if you read the PR description, we unfortunately needed to convert it over to ESM in order to get it working properly in another
module: node16
+ ESM repo I'm working on. If you look at the "before" results in the image below, it wasn't working properly in ESM nor in CJS.The good thing is that the website says that we're still shipping our main CJS exports with the same warnings as we were before (see the "
node16
from CJS" row on this page). Based on the warnings warnings, my guess is that these are issues with ourtsup
configuration or the code itself and not ourpackage.json
exports
definition.Before the
exports
fixes in this PR (oas@21.0.3
):After the
exports
fixes in this PR (oas@21.1.1
):