Fix missing types when resolving cjs with require #16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "patch-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When typescript resolves types with cjs mode and require it will look for require in conditional exports but won't find types, and will ignore type field in the parent, leading to missing types.
I have this problem on
node@20.16.0,typescript@5.9.3, in a lib using@codemirror/view@6.38.6.Adding types to the export in package.json fixes it.
Though I don't remember precisely what the issue was, there was a reason why we ended up creating a .d.cts file to solve this problem in my other packages, so attached patch applies that solution here as well.
Pull request closed