Skip to content

Type resolve error in Node ESM mode #29

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

Closed
otakustay opened this issue Jan 22, 2024 · 2 comments · Fixed by #30
Closed

Type resolve error in Node ESM mode #29

otakustay opened this issue Jan 22, 2024 · 2 comments · Fixed by #30
Labels
bug Something isn't working

Comments

@otakustay
Copy link

For TS project having "moduleResolution": "NodeNext" in tsconfig.json and "type": "module" in package.json, TypeScript can't resolve to correct types.

import parseGitDiffExport from 'parse-git-diff';

// This expression is not callable.
//  Type 'typeof import("node_modules/parse-git-diff/build/types/index")' has no call signatures.ts(2349)
parseGitDiffExport(diff);

This is how TypeScript's NodeNext mode interacts with CommonJS packages, seems the only fix is to put index.d.ts in both build/cjs and build/mjs and then remove "types" key in exports field.

@yeonjuan
Copy link
Owner

yeonjuan commented Jan 23, 2024

@otakustay Thank you for reporting the issue. �I can reproduce the error. This is clearly a bug and should be fixed!.

@yeonjuan yeonjuan added the bug Something isn't working label Jan 23, 2024
@yeonjuan
Copy link
Owner

yeonjuan commented Feb 9, 2024

@otakustay It's fixed and released in v0.0.15! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants