-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Use more nodelike paths for import types when possible #24610
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
Use more nodelike paths for import types when possible #24610
Conversation
|
We have the code to this in the services. We use it to generate import quick fixes. |
3543ffb to
052d1a2
Compare
|
@mhegazy Moved, patched |
052d1a2 to
d79d781
Compare
…/directory conflict handling
d79d781 to
ebfda15
Compare
|
@sheetalkamat and @Andy-MS can you please review this change. |
src/compiler/moduleSpecifiers.ts
Outdated
| const extensions = getSupportedExtensions({ allowJs: true }, [{ extension: "node", isMixedContent: false }, { extension: "json", isMixedContent: false, scriptKind: ScriptKind.JSON }]); | ||
| for (const e of extensions) { | ||
| const fullPath = path + e; | ||
| if (host.fileExists!(fullPath)) { |
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.
Might want to mark this with #18217
* Use more nodelike paths for import types when possible * move functionality from services into compiler, fix with propert file/directory conflict handling * mark suspect cast
Partial fix for #24599
A complete fix (ie, one where
/indexis also removed and maybe wherepackage.json's get walked backward) requires a much more complex reverse resolver to check there's no directory/file conflicts (in the case of/index) and for file contents (in the case of reversing apackage.json). If we think that's worth doing, we can; but this simple change of stripping the leading relative part makes the output as portable as is usually expected.