Update cheatsheets

This commit is contained in:
ivuorinen
2025-09-05 00:19:23 +00:00
parent 7bb915f683
commit 9b4b323d91
8 changed files with 68 additions and 13 deletions

View File

@@ -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]}}`