Compile a configured project
Build a repository using its nearest tsconfig.json.
TypeScript · Command
tsc is the TypeScript compiler command. Run it with no inputs to build the nearest configured project, or provide files and compiler options for a direct compilation.
The tsc command invokes the TypeScript compiler. With no input files, it uses the nearest project configuration; with file paths supplied, it compiles those inputs directly and ignores tsconfig.json files.
tsc [options] [file ...]| Name | Type | Description |
|---|---|---|
files | string[] | Optional source files or glob patterns to compile. |
--project, -p | string | Path to a tsconfig.json file or a directory containing one. |
Emits JavaScript and related output according to the selected compiler options, or reports diagnostics; some options instead inspect configuration or file membership and stop without a normal build.
tsc without input files compiles the nearest configured project.--init option creates a starter project configuration.--showConfig to inspect the resolved configuration without compiling.--listFilesOnly to inspect which files belong to the compilation.--all to display the complete CLI option list.--project or -p when you need to select a specific configured project.tsc --strict --outDir dist src/index.tsCompiles the specified TypeScript file with strict checking and writes emitted output under dist.
Build a repository using its nearest tsconfig.json.
Compile selected files with command-line options.
Inspect or initialize project configuration.
tsconfig.json--project--init--showConfig--listFilesOnly--all