How to Check TypeScript Version

What you’ll build or solve

You’ll confirm which TypeScript version is installed globally or inside a specific project. By the end, you’ll know how to check the active version and verify it if something looks wrong.

When this approach works best

This method works best when:

  • A tutorial requires a minimum TypeScript version.
  • Your project behaves differently on another machine.
  • You suspect a global and local version mismatch.

This is unnecessary in browser-based editors that manage TypeScript for you.

Prerequisites

  • Node.js installed
  • TypeScript installed globally or locally

If TypeScript is not installed, install it first before checking the version.


Step-by-step instructions

Step 1: Check with the tsc command

This is the primary and most reliable method.

Check global installation

Run:

or:

tsc--version

If TypeScript is installed globally, you’ll see something like:

Version 5.4.2

If you see command not found or tsc is not recognized, TypeScript is not installed globally.


Check local project installation

If TypeScript is installed inside a project, move into that folder:

cd my-project

Then run:

npx tsc-v

npx uses the local version inside node_modules.

What to look for

  • If tsc -v and npx tsc -v show different versions, your project uses its own version.
  • When running build scripts inside a project, the local version takes priority.
  • If npx tsc -v fails, TypeScript is not installed locally in that folder.

Once one of these commands prints a version number, you’ve successfully checked your TypeScript version.


Step 2: Use alternative verification methods

Use these when the tsc command is unclear or when debugging setup issues.

Option A: Check package.json

Open your package.json file and look under devDependencies:

{
  "devDependencies": {
    "typescript":"^5.4.2"
  }
}

This shows the version your project expects.

Keep in mind this shows what should be installed, not necessarily what is currently installed.


Option B: Use npm list

Inside your project folder, run:

npm list typescript

This prints the exact installed version from node_modules.

Use this if you want to confirm what is actually installed on disk.


Option C: Check programmatically (for scripts)

If you are writing build tools or debugging scripts, you can check the version with Node:

node-p"require('typescript').version"

This works inside a project where TypeScript is installed locally.

Use this method when you need the version inside automation or custom scripts.


Examples you can copy

Example 1: Quick global check

Use this after installing TypeScript globally.


Example 2: Project-specific check

cd my-project
npx tsc--version

This confirms which version your project is using.


Example 3: Confirm installed dependency

cd my-project
npm list typescript

Use this when version mismatches appear between environments.


Common mistakes and how to fix them

Mistake 1: Checking outside the project folder

What someone might do:

Why it causes confusion:

This shows the global version, not the project version.

Correct approach:

cd my-project
npx tsc-v

Mistake 2: Assuming Node includes TypeScript

What someone might do:

node-v

Why it misleads people:

Node.js and TypeScript are separate tools.

Correct approach:

If that fails, install TypeScript.


Mistake 3: Checking before installing locally

What someone might do:

npx tsc-v

In a project without TypeScript installed.

Why it fails:

No local dependency exists.

Correct approach:

npm install--save-dev typescript
npx tsc-v

Troubleshooting

If you see tsc: command not found, install TypeScript globally or use npx.

If npx tsc fails, confirm you are inside the correct project directory.

If Cannot find module 'typescript' appears, install it locally:

npm install--save-dev typescript

If global and local versions differ, update one of them so they match.


Quick recap

  • Use tsc -v to check the global version.
  • Use npx tsc -v to check the project version.
  • Local versions override global versions in projects.
  • Use npm list typescript to confirm what is installed.
  • Use node -p "require('typescript').version" for script-level checks.