TypeScript 7 cheatsheet

TypeScript 7: Compiler and running

11 common TypeScript 7 tasks.

Install TypeScript

Add the compiler to a project as a development dependency.

npm install --save-dev typescript

Check the compiler version

Print the installed compiler version.

npx tsc --version

Create a tsconfig.json

Generate a tsconfig.json with commented options.

npx tsc --init

Compile the project

Compile using tsconfig.json.

npx tsc

Type-check without output

Check types and report errors, writing no files. The usual command in CI.

npx tsc --noEmit

Compile on changes

Recompile when files change.

npx tsc --watch

Use another config file

Compile with a specific tsconfig, for example one used only for builds.

npx tsc -p tsconfig.build.json

Show the resolved config

Print the final configuration, with extends and defaults applied.

npx tsc --showConfig

Run a TypeScript file with Node.js

Node.js 24 strips types and runs the file directly. It supports only syntax that erases to JavaScript, so enums and namespaces are not allowed by default.

node app.ts

Run a TypeScript file with tsx

Run TypeScript with a runner that handles more syntax and module settings.

npx tsx app.ts

Install type definitions

Add types for a library that doesn't ship its own.

npm install --save-dev @types/node

Was this page helpful?