-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Allow allowImportingTsExtensions
: without either '--noEmit' or '--emitDeclarationOnly'
#61213
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
Comments
in my setup i am using |
We consider anything that has its own interpretation of module specifiers to be a bundler, so something that postprocesses the output names qualifies as that. To wit, we don't understand what the limitations of your processing are, and can't make any assumptions about what path transforms do/don't work in your setup. What's wrong with using |
Please note |
Correct; see #60397 |
This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
π Search Terms
allowImportingTsExtensions, allow importing ts extensions, emit, noEmit, emitDeclarationOnly, emit declaration only,
β Viability Checklist
Note
Feature would have the user explicitly state they don't want valid JS (eg., as with omitting file extension completely, which is currently a valid syntax for emitting JS, and is more implicit) - Possibly would disagree with goal 4 of the design goals depending on the exact meaning of "clean, idomatic, recognisable". Note this is the same request as #53316
β Suggestion
Without
"moduleResolution": "bundler"
and"noEmit": true
TypeScript will now happily emit JavaScript when using this option for allowImportingTsExtensions.
π Motivating Example
tsc
compiles just fine when the source has imports with .ts extensions andnoEmit
is false, except--noEmit
which is requiredWe can easily fix the compiled output with some postprocessing (like, sed), using tsc for the compilation.
In this workflow, I am using not using a bundler to compile, and I want tsc to emit output. The only problem is the error message thrown by tsc.
π» Use Cases
.ts
extensions in imports in the source code when refering to.ts
filesallowImportingTsExtensions
is true butnoEmit
is false.js
extensions in imports in the source code when refering to.ts
files feels invalidGlad you asked :-)
I've set
noEmit: true
andmoduleResolution: node
in tsconfig.json, but from the command line (or package.json), I usewhich effectively runs tsc once without output, if it succeeds runs it with output but surpressing the error and always return true, and then postprocesses the result.
The text was updated successfully, but these errors were encountered: