PLB
PLB

Reputation: 891

Four different versions of typescript?

I'm trying to teach myself Angular and while updating my versions (node, angular-cli, ...) I stumbled upon 4 different versions of Typescript. Could anyone tell me the difference?

On the left side of the following screenshot is vscode. The upper part is the result of "ng version". The data cut-off from the screenshot was:

 - Angular CLI: 7.3.9
 - Node: 10.15.3
 - OS: win32 x64
 - Angular: 7.1.4
... common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

On the right-side a cmd prompt which I opened in my user location.

enter image description here

I'll try to give my own explanation, please correct me :)

  1. 3.1.6 I would say that this is the Typescript version which I am using in my project
  2. 3.2.2 Then this might be my global version (the one currently installed in %AppData%\Roaming\npm)
  3. 3.4.5... no idea about this one. I just looked it up and it is actually the newest available version at the moment of this post. This is higher than what Angular 7.1.4 supports (3.3 is supported by Angular 8.0.0-beta.9 as I found out here... it's a breaking change so this shouldn't work at all as far as I understand). I wonder if this is number is not displaying something else than Typescript (but what?)
  4. 3.2.4 this one puzzles me, I have no clue where it is coming from

I also ran npm list typescript locally and globally. Not sure what this means (as I said, I'm still trying to learn...) but this is the result:

enter image description here

Upvotes: 0

Views: 1819

Answers (2)

asimhashmi
asimhashmi

Reputation: 4378

Version 3.1.6

You are right, this is your local version of Typescript which is specific to your project.

Version 3.2.2

This is the global version of Typescript. That's why it is not changing in both location when you type tsc --version

There are some packages that requires specific versions of other libraries to work properly

Version 3.2.4

It is the dependency of @angular/cli i.e. when you'll install @angular/cli, it will automatically install this version of typescript as a dependency to work property.

Version 3.4.5

It is displaying in the right corner of VS code. Vs code comes with its own version of Typescript which it uses internally because the editor is written in Typescript.

Upvotes: 4

dRoyson
dRoyson

Reputation: 1507

That's a pretty neat analysis and you have almost got it right in your own explanation. As for the missing pieces, check the explanation below:

3.1.6 as you have rightly noted is the one used installed in your project

3.2.2 is the one that you have installed globally.

3.2.4 is the typescript installed by angular-cli.

3.4.5 is the latest version which is supported by your current version of Visual Code. The intellisense provided by Visual Code will use this version.

To the best of my knowledge your Angular project will run on TSC version 3.1.6 since it's referenced locally. (Correct me if I get this wrong)

You need not worry about having breaking changes since version 3.4.5 is meant only for VS Code to provide intelli-sense.

Upvotes: 1

Related Questions