NOTE: These steps are only required if you want to use a version of TypeScript that is not the same as the version that is bundled with Visual Studio Code.
-
Install the latest version of TypeScript
npm install -g typescript@version
-
Configure VS Code to use installed version of TypeScript by opening Preferences, User Settings.
- Settings on Mac:
{ "typescript.tsdk": "/usr/local/lib/node_modules/typescript/lib/" }
- Settings on Windows - substitute {User Name}:
{ "typescript.tsdk": "c:\\Users\\{User Name}\\AppData\\Roaming\\npm\\node_modules\\typescript\\lib" }
- Settings on Linux:
{ "typescript.tsdk": "/usr/lib/node_modules/typescript/lib/" }
@mariusschulz For new projects by default I would probably want to use the version of TypeScript installed globally, because it might be higher than the version bundled with VS Code. If for a particular project I want to use a specific version (e.g. beta) of TypeScript, then I could always define typescript.tsdk in the workspace settings to point to the local copy, as described in your article. There is no harm in setting the version in user settings because the workspace will always override the global settings.