Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print typescript compiler options

Is there a way to print the options used by tsc? I feel like it doesn't take my tsconfig.json into account and I'm looking for a flag that would allow me to know what kind of options it's trying to use.

like image 990
Loic Coenen Avatar asked May 09 '18 20:05

Loic Coenen


People also ask

Which compiler is used for TypeScript?

The TypeScript compiler, named tsc , is written in TypeScript. As a result, it can be compiled into regular JavaScript and can then be executed in any JavaScript engine (e.g. a browser).

Does TypeScript compile or Transpile?

Typescript does transpile into Javascript. In your tsconfig configuration file, you can specify which is the target language you want it transpiled to. That means you can already work with cutting edge ECMAScript features out of the box.

How do I get a TypeScript compiler?

TypeScript is available as a package on the npm registry available as "typescript" . You will need a copy of Node. js as an environment to run the package. Then you use a dependency manager like npm, yarn or pnpm to download TypeScript into your project.

What does TSC do in TypeScript?

Tsc stands for `TypeScript compiler` and is a simple tool included in Typescript itself, allowing you to compile any ts files into js.


2 Answers

tsc --showConfig

will show the complete config that will be used for compilation.

The --showConfig flag has been added in typescript 3.2:

TypeScript will calculate the effective tsconfig.json (after calculating options inherited from the extends field) and print that out. This can be useful for diagnosing configuration issues in general.

Description from the compiler options documentation:

Rather than actually execute a build with the other input options and config files, show the final implied config file in the output.

like image 67
TmTron Avatar answered Nov 12 '22 23:11

TmTron


Currently there is no option to dump the loaded configuration.

You may want to upvote the issue:

  • Dump the effective config file - Issue #15213 - Microsoft/TypeScript

Edit: tsc --showConfig has been implemented as of v3.2.1.

like image 31
snipsnipsnip Avatar answered Nov 13 '22 01:11

snipsnipsnip