Allow allowImportingTsExtensions
: without either '--noEmit' or '--emitDeclarationOnly'
#61213
Open
5 of 6 tasks
π 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: