Reputation: 105497
I'm using:
$ tsc --version
Version 2.0.8
and trying to pass --experimentalDecorators
option to tsc
like this:
$ tsc --experimentalDecorators true greeter.ts
//error TS6053: File 'true.ts' not found.
and like this
$ tsc greeter.ts --experimentalDecorators true
//error TS6053: File 'true.ts' not found.
and like this
$ tsc greeter.ts --experimentalDecorators=true
// error TS5023: Unknown compiler option 'experimentaldecorators=true'.
but no luck. What's the correct way to pass options to tsc
?
Upvotes: 3
Views: 1180
Reputation: 15327
Currently, the compiler allows passing in explicit boolean values.
There is a strong use case for passing in explicit boolean values to the compiler, when you are compiling against a tsconfig.json
and want to override a specific value for the purposes of the current compiler run.
In this case, imagine if your tsconfig.json
sets experimentalDecorators
to false, and you want to test the compilation when it is true
without changing the project itself:
tsc --experimentalDecorators true greeter.ts
Upvotes: 6
Reputation: 106650
Boolean flags are false by default so you don't need to specify a value along with the flag. You only need to include the flag when you want to change it from false to true.
Remove true
:
tsc --experimentalDecorators greeter.ts
For compiler options that expect a string, the value immediately following the argument specifies the argument's value. For example:
tsc --module system greeter.ts
For compiler options that expect an array of strings, the individual string values should be separated by commas:
tsc --lib es5,es6 greeter.ts
The compiler assumes the value passed in is a filename if the value does not match an argument name or is not in the place of an expected argument value.
Upvotes: 2