Skip to content

Angular CLI compiler requires older Typescript #7625

Closed

Description

@jtsom

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.4.0
node: 8.4.0
os: darwin x64
@angular/animations: 4.3.6
@angular/cdk: 2.0.0-beta.10
@angular/common: 4.3.6
@angular/compiler: 4.3.6
@angular/core: 4.3.6
@angular/forms: 4.3.6
@angular/http: 4.3.6
@angular/material: 2.0.0-beta.10
@angular/platform-browser: 4.3.6
@angular/platform-browser-dynamic: 4.3.6
@angular/router: 4.3.6
@angular/cli: 1.4.0
@angular/compiler-cli: 4.3.6
@angular/language-service: 4.3.6
typescript: 2.5.2

Repro steps.

Start up app with ng serve and this message is displayed:

@angular/compiler-cli@4.3.6 requires typescript@'>=2.1.0 <2.4.0' but 2.5.2 was found instead.
Using this version can result in undefined behaviour and difficult to debug problems.

Please run the following command to install a compatible version of TypeScript.

    npm install typescript@'>=2.1.0 <2.4.0'

To disable this warning run "ng set --global warnings.typescriptMismatch=false".

Activity

  1. kuncevic commented on Sep 8, 2017

    @kuncevic

    Based on that commit it should allow 2.5+ but I have same issue even with 2.4.2 and angular 4.3.6

    UPDATE: Based on that sounds like typescript: '>=2.4.0 <2.6.0' required angular compiler '>=5.0.0 <6.0.0'

  2. karser commented on Sep 8, 2017

    @karser

    Newly created project with angular-cli@1.4.0 requires typescript@~2.3.3

  3. kondi commented on Sep 8, 2017

    @kondi

    Is this requirement valid? My project looks fine with typescript@2.4.2 and I was planning to go for 2.5.x but now I am not sure if it is a good idea.

  4. kondi commented on Sep 8, 2017

    @kondi

    Anyway it would be good if @angular/compiler-cli would define the correct peer dependency here: https://github.com/angular/angular/blob/4.4.x/packages/compiler-cli/package.json#L17. Not everybody is using angular-cli. I can understand the safety check, but I am not sure the matrix linked by kuncevic should be the correct place to specify the requirements.

  5. jtsom commented on Sep 8, 2017

    @jtsom
    ContributorAuthor

    There were no indications that this restriction would be implemented. The only thing I updated in my project was the CLI. The @angular/compiler-cli@4.3.6 has no problems previously.

  6. filipesilva commented on Sep 8, 2017

    @filipesilva
    Contributor

    These versions shown in the warning are the ones recommended by the Angular team.

    A lot of bugs that are reported are actually the result of using incompatible versions, and it is not clear at all what these versions are. This is not a new restriction: incompatible versions have caused problems for a while now.

    It is true that other typescript versions may work in your particular project - but we cannot guarantee they will work. That is why we show a warning now (but not an error).

    It became more important to alert users to what the recommended versions are because Angular version 5 is coming out and it has its own recommend set of typescript versions.

    There are two factors preventing simply adding a strict dependency:

    • the CLI must support Angular versions 2, 4, and 5
    • Angular itself does not have a dependency/peer dependency on typescript

    So it was better to show a warning than to prevent usage of other typescript versions. If you feel confident that your project should work with other versions of typescript, you can disable the warning. This is useful when using versions of libraries that specifically need typescript of a certain version for compilation to be successful.

  7. fmorriso commented on Sep 8, 2017

    @fmorriso

    @filipesilva : Thanks for the high-level explanation.

    For those of us who wish to "scout ahead" using TypeScript versions beyond what is recommended, is there a place where any known issues (with or without a fix/work-around) have been documented?

  8. xnnkmd commented on Sep 13, 2017

    @xnnkmd

    @filipesilva See also #7678 which would help a lot related to the warning.

  9. TitaneBoy commented on Sep 20, 2017

    @TitaneBoy

    Hi guys...
    Having the same issue with @angular/compiler-cli@4.4.3

    Node: 8.4.0
    Typescript: 2.5.2

    But as we can see in the package.json of angular/compiler-cli, it saids, in its peerDependencies, that it needs typescript ^2.0.2, and typescript@2.5.2 should meet this requirement

  10. added
    P5
    on Sep 22, 2017
  11. dherges commented on Sep 27, 2017

    @dherges

    Maybe the dependencies on typescript should be a peerDependencies?

    A CLI project may now cause more confusion:

    - node_modules
      |- @angular
         |- cli
            |- node_modules
               |- typescript # <- 2.5.x (from cli package.json >=2.0.0 < 2.6.0)
      |- typescript # <- 2.4.x (from package.json)
    package.json
    
  12. added and removed
    P5
    on Sep 27, 2017
  13. 4 remaining items

  14. dherges commented on Oct 2, 2017

    @dherges
  15. filipesilva commented on Oct 2, 2017

    @filipesilva
    Contributor

    It would, but asking people to install both the cli and typescript globally isn't a good solution either imho.

  16. dherges commented on Oct 27, 2017

    @dherges

    Is it right, that anguilar cli now uses the typescript version installed ion the user's project workspace?

    fix(@angular/cli): remove typescript dependency
    a28a967
    #8185

  17. filipesilva commented on Oct 27, 2017

    @filipesilva
    Contributor

    @dherges it almost always did, except when the dependency wasn't hoisted. That PR is meant to address that case.

  18. CreepyGnome commented on May 14, 2019

    @CreepyGnome

    It seems this is still the case today that the latest Angular Compiler requires an older version of TypeScript, but just the compiler. I mean we are talking minor version limitations not major versions this seems odd. It should require just a min or greater version and block the next major version.

    Currently today you get this error:

    The Angular Compiler requires TypeScript >=3.1.1 and <3.3.0 but 3.4.5 was found instead.

    Seem like it should just require TypeScript >=3.1.1 and <4.0.0 until there is a broken minor release which would hopefully be rare.

    Should we just always assume that if we want to use the latest stable release of Angular we always have to run versions behind the latest stable version of Typescript?

  19. alan-agius4 commented on May 14, 2019

    @alan-agius4
    Collaborator

    @CreepyGnome, Typescript minor version can be breaking and that's why we only support versions that have been released.

  20. CreepyGnome commented on May 14, 2019

    @CreepyGnome

    Currently, it doesn't support anything newer than 3.2.4 and there have been other released versions since then. The current released version is Typescript 3.4.5.

    So based on your statement shouldn't Typescript 3.4.5 be supported then?

  21. alan-agius4 commented on May 14, 2019

    @alan-agius4
    Collaborator

    It is supported in version 8 release candidate.

  22. alan-agius4 commented on May 14, 2019

    @alan-agius4
    Collaborator

    Closing the initial reported issue should be solved by now.

    If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

  23. angular-automatic-lock-bot commented on Sep 9, 2019

    @angular-automatic-lock-bot

    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.

  24. locked and limited conversation to collaborators on Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions