-
Notifications
You must be signed in to change notification settings - Fork 12.8k
In import fixes, use a ".js" extension if other imports do #20624
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
Conversation
15f851e
to
fffc5f9
Compare
fffc5f9
to
7588c15
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. Our expectation is that users will manually correct the first generated input in a file and that things will work correctly thereafter?
return addJsExtension | ||
? noExtension + ".js" | ||
: getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeJs | ||
? removeSuffix(noExtension, "/index") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know the JS/TS convention, but I'm using to seeing these lines indented.
////export function b() {} | ||
|
||
// @Filename: /c.ts | ||
////import { a } from "./a.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For documentation purposes, it might be nice to add a test where some imports have extensions and others do not. (It looks like absolute paths might also be treated specially.)
Ideally we would have an option for this (#20619) but yeah, for now we will rely on the user manually correcting the first import. |
Fixes #19019