In import fixes, use a ".js" extension if other imports do#20624
Merged
2 commits merged intomasterfrom Jan 3, 2018
Merged
Conversation
15f851e to
fffc5f9
Compare
fffc5f9 to
7588c15
Compare
amcasey
approved these changes
Jan 3, 2018
Member
amcasey
left a comment
There was a problem hiding this comment.
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") |
Member
There was a problem hiding this comment.
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"; |
Member
There was a problem hiding this comment.
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.)
RyanCavanaugh
approved these changes
Jan 3, 2018
Author
|
Ideally we would have an option for this (#20619) but yeah, for now we will rely on the user manually correcting the first import. |
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #19019