Skip to content
Tutorials Center
My learning

Topics

TypeScript Reference ยท The tsc Command Line

tsc --version

Reference for tsc --version (-v): print the installed compiler version, check which copy of tsc runs, and understand versions in editors and CI.

tsc --version (short form -v) prints the version of the compiler that runs, in the form Version 7.0.2, and exits. It is the first thing to check when a language feature or an error message does not match what the documentation says.

A machine can hold several TypeScript versions at once: a global install, one per project in node_modules, and one bundled with your editor. The version command tells you about the one that was actually launched.

TEXT
tsc --version
tsc -v
npx tsc -v

Try it

You can inspect the running language level from code. These programs use features that exist only in recent TypeScript releases, so they act as a quick check of what the compiler supports.

TypeScript Features of recent versions

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.

TypeScript Reading the Node version that runs the output

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.

Syntax

TEXT
tsc --version

Output: one line, Version <major>.<minor>.<patch>, possibly with a pre-release tag such as -beta or -rc. Nothing else is printed and no files are compiled.

Edge cases: tsc found through npx is the project-local one if installed; otherwise npx may download and run the latest. A global tsc may differ from the local one. Editors show their own TypeScript version in their status bar.

Usage notes

  • Pin it. Use an exact or tilde version in package.json; compiler upgrades can change inference and add errors.
  • Compare in CI. Print npx tsc -v at the start of a build so logs record the version used.
  • Editor mismatch: if the editor reports errors the command line does not (or the reverse), pick the workspace version in the editor, so both use the same compiler.
  • Compiler API: ts.version gives the same string from code that imports typescript.
  • Major versions: 7 is the native compiler; most options and diagnostics carried over from 5.x, but a few old options were removed.