TypeScript Cheat Sheet/Compile a specific project file

Use a given tsconfig path.

Section: Setup and CLI

Compile a specific project file

bash
bash
npx tsc -p tsconfig.json
Explanation

Pass `-p` or `--project` to point TypeScript at a specific config file or directory.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Setup and CLI
Initialize tsconfig
Create a starter tsconfig.json in the current project.
OpenIn sheetbashsame section
Show TypeScript version
Print the installed TypeScript compiler version.
OpenIn sheetbashsame section
Type-check without emitting JS
Run the compiler only for type-checking.
OpenIn sheetbashsame section
Compile in watch mode
Rebuild automatically when files change.
OpenIn sheetbashsame section
Build project references
Use build mode for multi-project repos.
OpenIn sheetbashsame section
Explain included files
Show why files are part of the compilation.
OpenIn sheetbashsame section