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).
Videos
» npm install tsc
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
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?
It's likely that you have an old version of TypeScript installed for Visual Studio, and that the Visual Studio installation is shadowing the one installed through npm. You will probably need to change your PATH variable.
To check, open up a Command Prompt (CMD.exe) and type in
where tsc
If the first items are not associated with Node/npm, and are instead installed in something like C:\Program Files (x86)\Microsoft SDKs\TypeScript\..., then you'll need to configure your system environment variables.
- Open up your start menu.
- Search for
system environment variables - Open the item titled
Edit the system environment variables - Ensure that the
PATHenvironment variable has the Node/npm location prioritized over the Visual Studio location.- Also ensure that any newer Visual Studio installation locations are prioritized over older ones.
Also see this answer.
I believe you need to do
npm install -g typescript@latest
or
npm update -g typescript
As answered enter link description here
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
Try npm install -g typescript@latest. You can also use npm update instead of install, without the latest modifier.
Open command prompt (cmd.exe/git bash)
Recommended:
npm install -g typescript@latest
or
yarn global add typescript@latest // if you use yarn package manager
This will install the latest typescript version if not already installed, otherwise it will update the current installation to the latest version.
And then verify which version is installed:
tsc -v
If you have typescript already installed you could also use the following command to update to latest version, but as commentators have reported and I confirm it that the following command does not update to latest (as of now [ Feb 10 '17])!
npm update -g typescript@latest