249

Maybe it's obvious, but I checked everywhere (besides the right place) and googled it. Nothing.

0

19 Answers 19

285

If you only have TypeScript installed for Visual Studio then:

  1. Start the Visual Studio Command Prompt
  2. Type tsc -v and hit Enter

Visual Studio 2017 versions 15.3 and above bind the TypeScript version to individual projects, as this answer points out:

  1. Right click on the project node in Solution Explorer
  2. Click Properties
  3. Go to the TypeScript Build tab
6
  • 7
    this did not work for me. I used the vs command window. I have vs 2013 update 3. It just said Command "tsc" is not valid.. What could be wrong?
    – Gustav
    Commented Oct 27, 2014 at 14:57
  • 7
    @Gustav, I think you are using VS' integrated Command Window (View -> Other Windows -> Command Window). You should use Visual Studio Command Prompt from the Start Menu.
    – orad
    Commented Feb 17, 2015 at 23:32
  • 4
    I used Package Manager Console, it worked also (it is available when you use nuggets) Commented Jul 14, 2015 at 13:49
  • 1
    It doesn't work for me, I found the answer stackoverflow.com/a/39912302/191647 Commented Oct 7, 2016 at 8:00
  • 2
    Outside of Visual Studio: npm install -g typescript; tsc -v Commented Mar 10, 2018 at 16:08
83

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:

Snapshot of VS Community "About" dialog

UPDATE (June 2017):

  1. VS 2013 does NOT show this info. (Later note: VS 2017 Enterprise edition does not show this info either).

  2. 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:

Typescript versions as folder names

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:

enter image description here

Then build your project and inspect the output: you should see the reference to one of Typescript folders described in (A).

0
55

Based in the response of basarat, I give here a little more information how to run this in Visual Studio 2013.

  • Go to Windows Start button -> All Programs -> Visual Studio 2013 -> Visual Studio Tools A windows is open with a list of tool.

Menu path for Visual Studio Tools

  • Select Developer Command Prompt for VS2013
  • In the opened Console write: tsc -v
  • You get the version: See Image

enter image description here

[UPDATE]

If you update your Visual Studio to a new version of Typescript as 1.0.x you don't see the last version here. To see the last version:

  • Go to: C:\Program Files (x86)\Microsoft SDKs\TypeScript, there you see directories of type 0.9, 1.0 1.1
  • Enter the high number that you have (in this case 1.1)
  • Copy the directory and run in CMD the command tsc -v, you get the version.

enter image description here

NOTE: Typescript 1.3 install in directory 1.1, for that it is important to run the command to know the last version that you have installed.

NOTE: It is possible that you have installed a version 1.3 and your code use 1.0.3. To avoid this if you have your Typescript in a separate(s) project(s) unload the project and see if the Typescript tag:

<TypeScriptToolsVersion>1.1</TypeScriptToolsVersion> 

is set to 1.1.

[UPDATE 2]

TypeScript version 1.4, 1.5 .. 1.7 install in 1.4, 1.5... 1.7 directories. they are not problem to found version. if you have typescript in separate project and you migrate from a previous typescript your project continue to use the old version. to solve this:

unload the project file and change the typescript version to 1.x at:

  <TypeScriptToolsVersion>1.x</TypeScriptToolsVersion>

If you installed the typescript using the visual studio installer file, the path to the new typescript compiler should be automatically updated to point to 1.x directory. If you have problem, review that you environment variable Path include

C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.x\

SUGGESTION TO MICROSOFT :-) Because Typescript run side by side with other version, maybe is good to have in the project properties have a combo box to select the typescript compiler (similar to select the net version)

5
  • 1
    I had 1.0 and 1.4 directories in the SDK folder, and setting <TypeScriptToolsVersion>1.4</TypeScriptToolsVersion> didn't do anything. Project was still using 1.0. I had to physically remove the 1.0 to correctly load 1.4. Commented Apr 22, 2015 at 0:11
  • Hi, No you don't need to remove the other folder. Please enter in the 1.4 directory and run there tsc -v. See what version do you have there. Greeting Commented Apr 24, 2015 at 23:36
  • Changing the PATH environment variable such that the TypeScript 1.4 path preceded the 1.0 path got VS2013 Update 4 to use version 1.4 for me. (Ugh!) Perhaps someone can clarify proper use of the Path environment variable vs <TypeScriptToolsVersion>.
    – Ian W
    Commented May 8, 2015 at 15:14
  • @IanW - I believe the value in the PATH variable is what tsc -v will read (from command line root; navigating to individual SDK directories and running command will show actual version), but VS.NET will use the version indicated in the <TypeScriptToolsVersion> value within the .csproj file. It seems tsc -v is a bit misleading as the PATH variable value is not updated when newer versions of TypeScript are installed. See the following: github.com/Microsoft/TypeScript/issues/2068
    – atconway
    Commented Jul 13, 2015 at 22:11
  • 1
    Microsoft says no - however there is a combo box for intellisense version you need to double check. Tools > Options > Text Editor > Javascript/Typescript > Typescript Version Commented May 23, 2017 at 19:47
28

The tsc -v command run technically reads the TypeScript compiler version within the SDK directory set within the Windows Path variable. This doesn't necessarily reflect the latest version installed as the Path variable is not updated with subsequent installations.

The version that VS.NET uses to compile the TypeScript is what's in the project's configuration:

<TypeScriptToolsVersion>1.5</TypeScriptToolsVersion>

To help explain this more in detail I created the following post which has the specifics on the TypeScript versions installed, and which version VS.NET uses to compile the TypeScript files.

Which Version of TypeScript is Installed and Which Version is Visual Studio Using?

I also added a feature request on Microsoft Connect to make viewing and switching the TypeScript targeted version in VS.NET easier. This isn't really a TypeScript feature request as much as it is a VS.NET IDE enhancement.

Allow switching TypeScript configured version from Project Properties IDE

4
  • My config said 1.7 but when writing in a .ts file it told me it was 1.4 (I tried to use namespace and intellisense said i was using 1.4 and that was only available in 1.5 and up in the)
    – Tony
    Commented May 13, 2016 at 0:27
  • 2
    Edit: My issue was caused by Resharper. It also has a setting that tells it which version of typescript to compile on. Geez,
    – Tony
    Commented May 13, 2016 at 0:50
  • 1
    Your answer assumes that all the work saved as a project file. A folder can be opened as a web project. Is there any other solution for those kind of web projects? Commented Nov 30, 2016 at 22:28
  • The feature is implemented in VS 2017. Commented Apr 25, 2018 at 10:17
14

The TypeScript team sorted this out in Visual Studio 2017 versions 15.3 and later, including the free Community edition.

How to See Which TypeScript Versions are Installed in Visual Studio

All you now need do is to go to project properties of any TypeScript Visual Studio project (right-click the project file in Solution Explorer/Properties), then go to the TypeScript Build tab on the left-hand side. This has a 'Typescript version' dropdown that shows you the version the project is using, and if you open it the dropdown shows you ALL versions of TypeScript currently installed in Visual Studio.

The actual installs are currently at C:\Program Files (x86)\Microsoft SDKs\TypeScript and then subfolders by version number, at least on Win10 on my computer. If you want to see the exact version (e.g. 2.8.3 rather than just 2.8) you can find the appropriate tsc.exe in here and look at its properties (Details tab in right-click/Properties in File Explorer).

How to Install Specific TypeScript Version

If you want to install a specific version of TypeScript then these can be found on Visual Studio Marketplace, although specific version numbers can be a little difficult to find in that list. A Google search for, for example, 'visual studio marketplace typescript 3.3.1' will usually find the exact version you want. If you install from here and restart Visual Studio the version will appear in the dropdown. Note also that some of the latest versions of TypeScript (e.g. 4.2) will refuse to install if there's a more recent version installed.

Node.js Console Applications

This answer does not apply to the 'Node.js Console Application' project type, which doesn't have a TypeScript Build tab in project properties. This is because it uses a version of TypeScript installed in the project folder using npm. The version can be seen and changed in the package.json file, and when installed appears under the npm entry in Solution Explorer, and in the node_modules/typescript folder on disk.

2
  • 1
    In facts, no. VS 2015 doesn't have dropdown with TS versions.
    – Kate
    Commented Sep 27, 2018 at 8:10
  • Could potentially conflict with the global version so the one installed globally in the machine and set with environment variable and that of a specific project installed via npm cause conflict? Commented Mar 4, 2022 at 5:50
12

On Visual Studio 2015 just go to: help/about Microsoft Visual Studio Then you will see something like this:

Microsoft Visual Studio Enterprise 2015 Version 14.0.24720.00 Update 1 Microsoft .NET Framework Version 4.6.01055

...

TypeScript 1.7.6.0 TypeScript for Microsoft Visual Studio

....

2
  • I just installed typescript v1.8.6 and this still reads v1.8.36. It is also the latter version in Tools -> Extensions and Updates. So not a good indication if you want to know that you are using the latest version for your project. Commented Sep 1, 2016 at 9:32
  • I'll just add that I don't know where Microsoft got version 1.8.36... it seems like it should be higher than 1.8.6 with 36 > 6 but it's not... this is the most confusion with versioning I have experienced... Commented Sep 1, 2016 at 9:52
11

You can run it in NuGet Package Manager Console in Visual Studio 2013.

3
  • In VS2012, this works as well: Tools -> Library Package Manager -> Package Manager Console
    – Kaganar
    Commented Mar 16, 2015 at 14:49
  • I've seen the npm install -g typescript command but that doesn't work for me?
    – Jules
    Commented Apr 22, 2015 at 16:09
  • 3
    @Jules Try checking if "C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;" is in your system PATH variable. I was having the same issue, it wouldn't pick up the 1.5.0-beta at all, after I installed using "npm install -g typescript", but it was because the PATH was interfering with it, and when I typed tsc, it looked in the PATH first and ran 1.0.3.
    – hsrob
    Commented May 18, 2015 at 3:18
6

As far as I understand VS has nothing to do with TS installed by NPM. (You may notice after you install TS using NPM, there is no tsc.exe file). VS targets only tsc.exe installed by TS for VS extension, which installes TS to c:\Program Files (x86)\Microsoft SDKs\TypeScript\X.Y. You may have multiple folders under c:\Program Files (x86)\Microsoft SDKs\TypeScript. Set TypeScriptToolsVersion to the highest version installed. In my case I had folders "1.0", "1.7", "1.8", so I set TypeScriptToolsVersion = 1.8, and if you run tsc - v inside that folder you will get 1.8.3 or something, however, when u run tsc outside that folder, it will use PATH variable pointing to TS version installed by NPM, which is in my case 1.8.10. I believe TS for VS will always be a little behind the latest version of TS you install using NPM. But as far as I understand, VS doesnt know anything about TS installed by NPM, it only targets whateve versions installed by TS for VS extensions, and the version specified in TypeScriptToolsVersion in your project file.

5

I have VS2015 and I have to run a build with TypeScript 1.7, although I have 1.8 installed via npm install typescript -g there are two ways (at least for me they worked):

  1. Go to your .proj file and add <TypeScriptToolsVersion>1.7</TypeScriptToolsVersion> as up as possible. Rebuild, re-run. If it doesn't work try 2.
  2. Go to Control Panel -> System -> Advanced System Settings -> Enviroment Variables. Make sure you add your desired TypeScript version first: C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7;C:\Users\serban\AppData\Roaming\npm

This will also affect your CLI:

$ tsc -v
message TS6029: Version 1.7.5
1
  • Finally, it's working! This answer was really helpful :) Commented Sep 11, 2020 at 6:54
5

First, make sure you have the following address in your Environment Variables Path

C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.0

Then open your Command Prompt and type the following command:

tsc -v
5

You can do npm list | grep typescript if it's installed through npm.

4

In the command prompt, simply type 1 of the following command then hit Enter :

  • tsc -v

    or

  • tsc -version

    or

  • tsc --version

Note: Make sure you have added Typescript to environment variable path before running command, details here: How to set environment variable.

5
  • 1
    it says "tsc is not recognized".
    – Kate
    Commented Sep 27, 2018 at 8:15
  • Ensure that typescript is set in the enviroment variables, in my case it looks like this: C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.2
    – Mwiza
    Commented Sep 28, 2018 at 9:14
  • 2
    those for local install won't work, instead use 'npx tsc --version' since npm 5.2.0 Commented Mar 4, 2022 at 9:31
  • @CarmineTambascia you should make this a regular answer, this answered the question for me, thanks!
    – Aileron79
    Commented May 24, 2023 at 14:52
  • 1
    @Aileron79 I just did if may be help someone else :) Commented May 24, 2023 at 21:08
3

Open a (normal, not the VS) command prompt or a PowerShell prompt.

tsc.exe -v tsc.cmd -v tsc -v

If you installed the same version of TypeScript for Visual Studio and using npm, the output from the above three commands should be the same.

If not, check your System PATH to see where in the path hierarchy and which typescript directory is listed. For PowerShell users, the easy way is: $env:path -split ';'

Be careful of having nothing or multiple TypeScript directories listed in your System PATH variable. As of June 9, 2017, my System PATH looked like this (just the top part, which is all that matters in this situation): ps>$env:path -split ';' C:\Windows\system32 C:\Windows C:\Windows\System32\Wbem C:\Windows\System32\WindowsPowerShell\v1.0\ C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.3 C:\nodejs\ C:\Users\{username}\AppData\Roaming\npm

Notice that only the 2.3 directory is included in the PATH, not multiple versions.

3

Update 2023

Adding what did worked for me:

For those for local install won't work, instead use:

'npx tsc --version' since npm 5.2.0 
2

For a non-commandline approach, you can open the Extensions & Updates window (Tools->Extensions and Updates) and search for the Typescript for Microsoft Visual Studio extension under Installed

2

If you'd like to find out what version of Typescript is being used on a particular project, go to your package-lock.json file. You will find something like this:

"typescript": {
      "version": "3.5.3"
}
0

As of Visual Studio 2022, there is a new TypeScript/JavaScript project type for Angular/React/Vue, the TypeScript SDK is deprecated (but still installable through the VS installer with warnings), and Visual Studio supposedly provides IntelliSense and language support based on the TypeScript version you're using for your project (npm is the preferred way to specify the version of TypeScript you're using, via your package.json file).

Per this answer, though, there are still questions about how to control/discern what specific TypeScript language version Visual Studio 2022 is supporting at any given moment.

0

VS Code -> Explorer -> package.json -> check dependencies.

Find typescript version in dependencies

0

in mac you can you this command as well.

npm tsc --version

Not the answer you're looking for? Browse other questions tagged or ask your own question.