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

TypeScript moduleResolution: NodeNext expects core.es2017.d.ts types file #298

Closed
bmcbarron opened this issue Mar 24, 2023 · 0 comments · Fixed by #302
Closed

TypeScript moduleResolution: NodeNext expects core.es2017.d.ts types file #298

bmcbarron opened this issue Mar 24, 2023 · 0 comments · Fixed by #302

Comments

@bmcbarron
Copy link

bmcbarron commented Mar 24, 2023

NodeNext module resolution strictly obeys exports, so for any exported file xxx.js, it looks for types in xxx.d.ts. I'm importing @react-rxjs/core in a web context, which maps to ./dist/core.es2017.js. Therefore, TypeScript expects the types to be found in ./dist/core.es2017.d.ts.

According to microsoft/TypeScript#52363, this behavior is by design, and the recommended course of action is to update the types files in the imported package. It seems unfortunate that multiple copies of the types file are needed, but I suppose each export version might actually have different types, which is why this would be needed.

Update: @rx-state/core is a type dependency of @react-rxjs/core. Fixing both is required for clean compilation. I suspect multiple other sibling libraries share the same issue.

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 a pull request may close this issue.

1 participant