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

Mention dual ESM/CJS declarations in extensionless readme and in the table #1

Conversation

fictitious
Copy link

No description provided.

@andrewbranch
Copy link
Owner

Ah, I was worried this might confuse people. All three strategies support dual ESM/CJS types; I just threw in some orthogonal variation to be able to show how subpath exports compose with more features, and mentioned it here:

Note that the separate handling of ESM and CJS, as well as the decision to present a unified set of types for the two, is orthogonal to the subpath exports demonstration. (Including separate types for CJS and ESM files, as extensionless does, is often a better choice, and is compatible with this strategy.)

@fictitious
Copy link
Author

fictitious commented Sep 21, 2022

Ah yes I got confused by the presence of "types" in exports in the other two strategies. I missed that comment, and thought that "types" was essential there.

But, for the types-versions-wildcards, it looks like "typesVersions" takes precedence over "exports", and it does not matter if the exports contains types or not. I have test code which shows that typings from "typesVersions" are always selected, even for ESM code with "moduleResolution": "node16", and sibling lookup does not happen. Is this a bug, or my misunderstanding, and/or should it be mentioned in the READMEs somewhere?

@andrewbranch
Copy link
Owner

That sounds like it might be a bug. I’ll investigate. Thanks!

@andrewbranch
Copy link
Owner

microsoft/TypeScript#50890

@fictitious fictitious closed this Sep 22, 2022
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

2 participants