Table of Contents

How to Change the Version of TypeScript Compiler in VSCode

Cyrus Kao
Last modified on .

By default, VSCode uses its own TSC (TypeScript Compiler), which is usually not the latest version of TypeScript. To enable the latest features, we'll need to install TypeScript in our package's dependencies and select the version from node_modules in VSCode (.vscode/settings.json).

Install TSC

Install the latest typescript as dev dependencies from NPM:

$ npm i -D typescript

Specific Version

To install a specific version of TypeScript:

$ npm i -D typescript@4.6.0-beta

Select in VSCode

Press Ctrl-Shift-P in VSCode to open command palette, search for Select TypeScript Version...:

Command palette
Command palette in VSCode

You'll need to gain focus on a .ts or .tsx file before opening the command palette, otherwise the options with TypeScript prefix won't show.

Select the Workspace Version (node_modules/typescript/lib):

Selecting TypeScript versions
Selecting TypeScript versions

Then a settings.json file will be created in .vscode folder, specifying the path of TSC binary:

settings.json of VSCode


Sign in to leave a comment.