If you only have TypeScript installed for Visual Studio then:
- Start the Visual Studio Command Prompt
- Type
tsc -vand hit Enter
Visual Studio 2017 versions 15.3 and above bind the TypeScript version to individual projects, as this answer points out:
Answer from basarat on Stack Overflow
- Right click on the project node in Solution Explorer
- Click Properties
- Go to the TypeScript Build tab
» npm install typescript
If you only have TypeScript installed for Visual Studio then:
- Start the Visual Studio Command Prompt
- Type
tsc -vand hit Enter
Visual Studio 2017 versions 15.3 and above bind the TypeScript version to individual projects, as this answer points out:
- Right click on the project node in Solution Explorer
- Click Properties
- Go to the TypeScript Build tab
Two years after the question was asked, using Visual Studio Command Prompt still did not produce right answer for me. But the usual Help|About window seems working these days:
UPDATE (June 2017):
VS 2013 does NOT show this info. (Later note: VS 2017 Enterprise edition does not show this info either).
VS uses Microsoft Build Engine (MSBuild) to compile Typescript files. MSBuild can support several major releases of Typescript, but About window shows only the latest one.
Here is how to get to the bottom of it:
A. To check which versions of Typescript are installed with your Visual Studio/MSBuild, inspect contents of C:\Program Files (x86)\Microsoft SDKs\TypeScript folder. For example, I have versions 1.0, 1.8 and 2.2:
B. Check which version of Typescript is requested by your project. In *.csproj file, look for <TypeScriptToolsVersion> tag, or you can add it if it is missing, like this
<PropertyGroup>
...
<TypeScriptToolsVersion>1.8</TypeScriptToolsVersion>
...
</PropertyGroup>
C. Finally, you can check, which version of Typescript is actually used by MSBuild. In TOOLS | Options | Projects and Solutions | Build and Run set MSBuild project output verbosity to Detailed:
Then build your project and inspect the output: you should see the reference to one of Typescript folders described in (A).
ts-node - how do I know what version of tsc it is actually using?
Is ts-node installed globally along with an older version of Typescript?
More on reddit.comnpm - How to upgrade Typescript to the latest version? - Stack Overflow
What TypeScript version is Visual Studio Code using? How to update it? - Stack Overflow
Deprecated `tsc` package alongside `typescript` in `package.json`
Videos
Hi all... so I am currently in the midst of upgrading an existing project to a newer version of typescript. The issue I am having is that in package.json we have a command to compile everything with tsc:
"test:build": "tsc --outDir ./dist"
and a command to run the project locally through nodemon and ts-node:
"build:live": "nodemon --exec node --inspect -r ts-node/register ./index.ts | bunyan -l debug",
The issue is that the first command that builds directly with tsc gives compilation errors where our code is not correct for the new version of typescript that I've specified in package.json. That's to be expected and its fine. But the latter command that runs with nodemon and ts-node continues to run quite happily with no errors, which leads me to believe that, behind the scenes, its using a different and older version of tsc.
So, how can I determine which version of tsc is actually being used by ts-node? And more to the point, how can I get it to use the new version that I am trying to target?
Thanks in advance for any help, and sorry if this is a bad question but I am relatively new to the world of node and not having any luck Googling for this.
Is ts-node installed globally along with an older version of Typescript?
When running tsc, it will compile all your source files listed in tsconfig.json. However, when using ts-node/register, it will only error at runtime when attempting to load the require()'d modules.
If you are getting errors on tsc in test:build, try changing the entry point from ./index.ts in build:live to one of the sources that is giving errors. Does it also fail then?
I had the same problem below procedure worked for me
Update NPM
npm install npm@latest -g
Update typescript
npm -g upgrade typescript
or
npm install typescript@latest -g
now you should see
tsc --version
Version 2.1.5
Since selected correct answer didn't help me I figured I'd share how I resolved the issue.
I had to remove C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\ from my PATH.
After that I could run this command and see the version I was expecting:
C:\>tsc --version
message TS6029: Version 1.5.3
» npm install tsc
If you only have TypeScript installed for Visual Studio then:
- Start the Visual Studio Command Prompt
- Type
tsc -vand hit Enter
Visual Studio 2017 versions 15.3 and above bind the TypeScript version to individual projects, as this answer points out:
Answer from basarat on Stack Overflow
- Right click on the project node in Solution Explorer
- Click Properties
- Go to the TypeScript Build tab
Can TypeScript be updated automatically?
VS Code ships with a recent stable version of TypeScript.
– from VS Code docs
This means there's no way to automatically upgrade the TypeScript version used by VS Code. You can however override the TypeScript version VS Code uses by modifying either the user settings or the workspace settings.
What TypeScript version is VS Code using?
When you open a TypeScript file, VS Code should display the TypeScript version in the status bar at the bottom right of the screen:
In newer versions (or when the status bar is crowded?) you may have to hover the mouse over the {} next to TypeScript to see a pop-up with the information:
Changing the global TypeScript version
- Install the desired TypeScript version globally, for example
npm install -g [email protected] - Open VS Code User Settings (F1 >
Open User Settings) - Update/Insert
"typescript.tsdk": "{GLOBAL_NPM_PATH}/typescript/lib"
Tip: You can find out {GLOBAL_NPM_PATH} by running npm root -g.
Now all of the projects you open with VS Code will use this TypeScript version, unless of course there is a workspace setting that overrides this.
Changing the local TypeScript version
Open the project in VS Code
Install the desired TypeScript version locally, for example
npm install --save-dev [email protected]The
--save-devwill update your project'spackage.json, adding the TypeScript version you installed as adevDependency.Open VS Code Workspace Settings (F1 >
Open Workspace Settings)Update/Insert
"typescript.tsdk": "./node_modules/typescript/lib"Now only the project you installed this TypeScript version in will use that TypeScript version, the global installation will be ignored by VS Code in this project.
Having added the
typescript.tsdkentry it's then also necessary to use the VS Code UI to select the new version:Click on the version displayed in the VS Code footer:
Select it in the UI:
See also:
- Using newer TypeScript versions
- Improve documentation for
typescript.tsdkto make workspace usage clearer
Visual Studio Code comes with its own stable version of TypeScript but you can switch to a newer version as described in their docs
VS Code ships with a recent stable version of TypeScript. If you want to use a newer version of TypeScript, you can define the typescript.tsdk setting (File > Preferences > User/Workspace Settings) pointing to a directory containing the TypeScript tsserver.js file.
...
For example:{ "typescript.tsdk": "node_modules/typescript/lib" }
» npm install typescript-compiler