commands.sh

tsc

all

TypeScript compiler.

More info →

Options (3)

-t, --targetboolean

Compile a TypeScript file into JavaScript using a specific target syntax (default is `ES3`)

Example: tsc {{[-t|--target]}} {{ES5|ES2015|ES2016|ES2017|ES2018|ESNEXT|...}} {{path/to/file.ts}}
-b, --buildboolean

Compile all `.ts` files of a TypeScript project defined in a `tsconfig.json` file (`--build` can be omitted to build the project in the current working directory)

Example: tsc {{[-b|--build]}} {{path/to/tsconfig.json}}
-w, --watchboolean

Run the compiler in watch mode, which automatically recompiles code when it changes

Example: tsc {{[-w|--watch]}}

Examples (8)

Initialize a TypeScript project

tsc --init

Compile a TypeScript file into a JavaScript file with the same name

tsc path/to/file.ts

Compile a TypeScript file into JavaScript using a specific target syntax (default is `ES3`)

tsc [-t|--target] ES5|ES2015|ES2016|ES2017|ES2018|ESNEXT|... path/to/file.ts

Compile a TypeScript file into a JavaScript file with a custom name

tsc --outFile path/to/output_file.js path/to/input_file.ts

Compile all `.ts` files of a TypeScript project defined in a `tsconfig.json` file (`--build` can be omitted to build the project in the current working directory)

tsc [-b|--build] path/to/tsconfig.json

Run the compiler using command-line options and arguments fetched from a text file

tsc @args.txt

Type-check multiple JavaScript files, and output only the errors

tsc --allowJs --checkJs --noEmit src/**/*.js

Run the compiler in watch mode, which automatically recompiles code when it changes

tsc [-w|--watch]
made by @shridhargupta | data from tldr-pages