Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TypeScript 2.4+ #7578

Closed
ghost opened this issue Sep 2, 2017 · 10 comments
Closed

Support TypeScript 2.4+ #7578

ghost opened this issue Sep 2, 2017 · 10 comments

Comments

@ghost
Copy link

ghost commented Sep 2, 2017

forgot to update the package.json for newly generated projects:

somehow was missed in this commit: 7b9fc28

also there's a weirder issue related to this. I updated the package.json in my angular-cli generated project to 2.4.x for typescript and whenever I run ng serve and ng build it seems to always use 2.3.3, while when I run $(npm bin)/tsc it is the correct version that matches what I put in the package.json.

@clydin
Copy link
Member

clydin commented Sep 3, 2017

This was intentional; note the description of the linked commit.

@ghost
Copy link
Author

ghost commented Sep 3, 2017

@clydin this description?

This PR doesn't change new projects to use 2.4 since I have seen some reports of possible problems in @angular/*.

Instead, it:

  • removes the dependency restrictions on <2.3
  • bumps related dependencies to the minimum that supports 2.4 (rxjs@^5.4.2, ts-node@~3.2.0)
  • builds the CLI itself using 2.4

So if you want to install ts 2.4 in your new project, the CLI itself won't stop you.

I installed typescript 2.4 in my angular project that uses angular-cli and it still looked like it was using 2.3 because it reported an error that would only happen with 2.3 installed. As noted, when I ran ng build it appeared to still use 2.3 while the node_modules directory definitely contained tsc 2.4.x and when I ran $(npm bin)/tsc it was running 2.4.x.

@clydin
Copy link
Member

clydin commented Sep 3, 2017

That part is definitely not intentional and is most likely a package manager related. Try removing the lock file and node modules directory and re installing. My guess is the lock file has TS 2.3 associated with the CLI.

@filipesilva
Copy link
Contributor

Closing as answered by @clydin. You can use npm list typescript (or yarn list typescript) to see what version you have installed as well if you suspect the right one isn't being installed.

@ghost
Copy link
Author

ghost commented Sep 5, 2017

is there a way to do this in angular-cli as it is building the package? can I drop in "tsc --version" right before it builds and right when it fails?

@clydin
Copy link
Member

clydin commented Sep 5, 2017

An npm ls typescript within the project root should show only one instance of typescript and it should be at the desired version (2.4.x in this case). If the version is wrong or there are multiple instances, then either package.json doesn't have the right version; or the package manager is trying to be helpful but failing, in which case removing the lock file should fix the issue.

@ghost
Copy link
Author

ghost commented Sep 5, 2017

@clydin ok cool, will give that a go. thanks!

@ghost
Copy link
Author

ghost commented Sep 14, 2017

removing the lock file did not fix my issue.

someone else was able to replicate the issue that caused me to report this: swimlane/ngx-datatable#927 (comment)

What is interesting is that angular-cli had one version of typescript and seemed to ignore the version of typescript used by the project.

+-- @ angular/cli@ 1.3.2
| -- typescript@ 2.4.2
-- typescript@ 2.5.2

@clydin
Copy link
Member

clydin commented Sep 14, 2017

@omouse , CLI version 1.3 only supports up to TS 2.4. You'll need to use CLI 1.4 or higher to support TS 2.5.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants