You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The error for allowImportingTsExtensions does not reference rewriteRelativeImportExtensions #60397
When specifying allowImportingTsExtensions as above, I get an error, as intended:
tsconfig.json:5:35 - error TS5096: Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set.
However, if I add "rewriteRelativeImportExtensions": true to the same tsconfig, the error goes away, which is contrary to the error message.
The behavior seems correct, but the error message seems incomplete or inconsistent.
At the same time, intellisense for allowImportingTsExtensions in VSCode reports:
Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.
This is only mentioned as a requirement in intellisense, but not in the error message.
🙂 Expected behavior
I would expect the message to reference rewriteRelativeImportExtensions as one of the conditions that allow for allowImportingTsExtensions.
I am not sure whether --moduleResolution bundler is required, but at least unifying the intellisense and diagnostic would be good.
The combination of factors seems to be "noEmit or emitDeclarationOnly or rewriteRelativeImportExtensions", but I am not sure what the exact new diagnostic message should be 😅
(I don't mean to be nitpicky! I tend to learn best from intellisense and the diagnostics errors, so I was on the lookout for them when trying out the 5.7.0-beta and rewriteRelativeImportExtensions 😌)
changed the title [-]The warning for allowImportingTsExtensions is inconsistent with rewriteRelativeImportExtensions[/-][+]The error for allowImportingTsExtensions does not reference rewriteRelativeImportExtensions[/+]on Nov 3, 2024
I couldn't find a working configuration for using rewriteRelativeImportExtensions and allowImportingTsExtensions together. I want tsc to emit, and rewrite .ts to .js. But the LSP errors on me when I add allowImportingTsExtensions: true to my tsconfig. Also rewriteRelativeImportExtensions isn't allowed in tsconfig, which doesn't make sense.
Edit: My bad. rewriteRelativeImportExtensions is allowed in tsconfig. VSCode was using 5.6 and it confused me.
Activity
[-]The warning for allowImportingTsExtensions is inconsistent with rewriteRelativeImportExtensions[/-][+]The error for allowImportingTsExtensions does not reference rewriteRelativeImportExtensions[/+]gkurt commentedon Dec 8, 2024
I couldn't find a working configuration for using
rewriteRelativeImportExtensionsandallowImportingTsExtensionstogether. I want tsc to emit, and rewrite.tsto.js. But the LSP errors on me when I addallowImportingTsExtensions: trueto my tsconfig. AlsorewriteRelativeImportExtensionsisn't allowed in tsconfig, which doesn't make sense.Edit: My bad.
rewriteRelativeImportExtensionsis allowed in tsconfig. VSCode was using 5.6 and it confused me.zanminkian commentedon Jan 7, 2025
Addition:
rewriteRelativeImportExtensionscan exist intsconfig.json, but official document does not mention it.bakkot commentedon Oct 6, 2025
Fix: #62557