tsc
TypeScript to JavaScript compiler
TLDR
SYNOPSIS
tsc [options] [file...]
DESCRIPTION
tsc is the TypeScript compiler that transforms TypeScript (.ts, .tsx) files into JavaScript (.js). Developed by Microsoft, TypeScript is a superset of JavaScript that adds optional static typing and modern language features.When run without arguments in a directory with tsconfig.json, tsc compiles the project according to that configuration. When files are specified on the command line, tsconfig.json is ignored unless -p is used.The compiler performs type checking to catch errors during development, then emits valid JavaScript. The --strict flag enables comprehensive type checking including strict null checks and no implicit any.Watch mode (-w) monitors source files and recompiles automatically when changes are detected, enabling a fast development workflow.
PARAMETERS
-p, --project path
Compile project from tsconfig.json at path-w, --watch
Watch input files and recompile on changes-t, --target version
ECMAScript target version (ES5, ES2015, ES2020, ES2022, ESNext)--outDir directory
Redirect output to specified directory--outFile file
Concatenate and emit output to single file--strict
Enable all strict type-checking options--noEmit
Do not emit outputs; type-check only--sourceMap
Generate corresponding .map source map files--declaration
Generate .d.ts declaration files--module system
Module system: commonjs, es2015, es2020, esnext, node16, nodenext--moduleResolution strategy
Module resolution strategy: node, nodenext, bundler--incremental
Enable incremental compilation for faster rebuilds--skipLibCheck
Skip type checking of declaration files--esModuleInterop
Enable interoperability between CommonJS and ES Modules--resolveJsonModule
Allow importing .json files--jsx mode
JSX handling: react, react-jsx, react-jsxdev, preserve--lib libs
Specify library files to include (e.g., ES2020, DOM, ES2020.Promise)--noEmitOnError
Do not emit outputs if any errors are reported--init
Initialize a tsconfig.json file--listFiles
Print names of files that are part of the compilation--showConfig
Print the final resolved configuration instead of compiling-h, --help
Show help-v, --version
Show version
CAVEATS
tsc requires Node.js and is typically installed via npm (npm install -g typescript). Compilation options on the command line override tsconfig.json settings. When files are specified on the command line, tsconfig.json is ignored (use -p to use a config file). Large projects may have slow compile times; consider using --incremental or --noEmit for type-check-only workflows.
HISTORY
TypeScript was developed by Microsoft under the lead of Anders Hejlsberg (creator of C# and Turbo Pascal). It was first publicly released in October 2012. The language was designed to address the challenges of large-scale JavaScript development by adding optional static types while maintaining full compatibility with existing JavaScript.
