error TS2835 suggests .js
extension when rewriteRelativeImportExtensions
is enabled
#60926
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
🔎 Search Terms
🕗 Version & Regression Information
⏯ Playground Link
Playground does not support multiple files to demonstrate the diagnostic
💻 Code
And in tsconfig:
Though here is my full tsconfig just in case:
🙁 Actual behavior
The diagnostic suggests a file extension ending in
.js
, even when bothallowImportingTsExtensions
andrewriteRelativeImportExtensions
are enabled.🙂 Expected behavior
The suggested import path should probably be
.ts
when these options are enabled.Assuming I had
rewriteRelativeImportExtensions: false
, and given my above settings which is not using bundler mode, it would make sense to suggest.js
. However, because rewrite is enabled, I think the best option would be to suggest.ts
.It also seems like tsserver should be able to offer an intellisense fix here in general, but I'm not sure, and that's a bit unrelated.
Additional information about the issue
Additionally, the wiki faq seems slightly outdated now with the addition of
rewriteRelativeImportExtensions
. It currently says the following:The text was updated successfully, but these errors were encountered: