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

Imports should use explicit .js extensions for moduleResolution=nodenext compatibility #99

Open
donmccurdy opened this issue Feb 7, 2025 · 0 comments

Comments

@donmccurdy
Copy link
Member

Imports in published .d.ts files must point to .js extensions, and TypeScript has for a very long time been against handling that renaming itself:

The filenames are supposed to be paths that can be resolved after TypeScript compilation, so we are stuck with either ./Filter or ./Filter.js. Currently the codebase has a mix of both ... so that is not great, I would like to clean it up to be consistent one way or the other. 😅

While I'm happy with either in an application, I think that for libraries we may need to use .js — because that's what should appear in the published .d.ts files. It's required for customers using certain configurations, particularly moduleResolution: 'nodenext'. I've had this feedback in some of my personal repositories in the past, longer discussion here:

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

No branches or pull requests

1 participant