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
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
How can I check the TypeScript version used in my Angular project?
Will updating the TypeScript version break my existing project?
What if I have multiple TypeScript versions installed globally and locally?
Open package.json file and check devDependencies node. It has typescript version used in project like below.
"typescript": "^2.4.0",
You can also use command prompt as Sajeetharan suggested in below answer.
If you want the exact version installed as a package dependency use the ls command:
npm ls typescript
Alternatively, you could run tsc with the -v flag:
If installed locally:
node_modules\.bin\tsc -v
If installed globally:
tsc -v
NOTE: If you plan on checking package.json for the version number, keep in mind the caret in ^2.4.0 means you could be getting 2.4.x, 2.5.x 2.6.x, etc. The ^ tells you the minor version will automatically be updated to the latest version upon a fresh install or an npm update.
If the version number is preceeded by ~ (i.e. ~2.4.0), then the patch number is automatically updated on a new install or update. That means any of the following versions could be installed: 2.4.0, 2.4.1, 2.4.2, etc, but not 2.5.x
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?
» npm install typescript