mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-18 21:01:14 +00:00
Update cheatsheets
This commit is contained in:
18
tldr/tsc
18
tldr/tsc
@@ -8,21 +8,25 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
> TypeScript compiler.
|
||||
> More information: <https://www.typescriptlang.org/docs/handbook/compiler-options.html>.
|
||||
|
||||
- Compile a TypeScript file `foobar.ts` into a JavaScript file `foobar.js`:
|
||||
- Initialize a TypeScript project:
|
||||
|
||||
`tsc {{foobar.ts}}`
|
||||
`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 --target {{ES5|ES2015|ES2016|ES2017|ES2018|ESNEXT}} {{foobar.ts}}`
|
||||
`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 {{output.js}} {{input.ts}}`
|
||||
`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:
|
||||
- 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 --build {{tsconfig.json}}`
|
||||
`tsc {{[-b|--build]}} {{path/to/tsconfig.json}}`
|
||||
|
||||
- Run the compiler using command-line options and arguments fetched from a text file:
|
||||
|
||||
@@ -34,4 +38,4 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Run the compiler in watch mode, which automatically recompiles code when it changes:
|
||||
|
||||
`tsc --watch`
|
||||
`tsc {{[-w|--watch]}}`
|
||||
|
||||
Reference in New Issue
Block a user