Skip to content

Crash in getJSDocTags on const a = b = () => 0; #24963

Closed

Description

TypeScript Version: 3.0.0-dev.20180609

Code

a.js

/** doc */
const a = b = () => 0;

Expected behavior:

No crash.

Actual behavior:

Error: Debug Failure. False expression.
    at getJSDocTags (/home/andy/.nvm/versions/node/v10.1.0/lib/node_modules/typescript/lib/tsc.js:10444:22)
    at getFirstJSDocTag (/home/andy/.nvm/versions/node/v10.1.0/lib/node_modules/typescript/lib/tsc.js:10451:24)
    at Object.getJSDocType (/home/andy/.nvm/versions/node/v10.1.0/lib/node_modules/typescript/lib/tsc.js:10428:19)
    at getContextualSignature (/home/andy/.nvm/versions/node/v10.1.0/lib/node_modules/typescript/lib/tsc.js:34131:32)
    at checkFunctionExpressionOrObjectLiteralMethod (/home/andy/.nvm/versions/node/v10.1.0/lib/node_modules/typescript/lib/tsc.js:36920:43)
    at checkExpressionWorker (/home/andy/.nvm/versions/node/v10.1.0/lib/node_modules/typescript/lib/tsc.js:37846:28)
    at checkExpression (/home/andy/.nvm/versions/node/v10.1.0/lib/node_modules/typescript/lib/tsc.js:37779:42)
    at checkBinaryLikeExpression (/home/andy/.nvm/versions/node/v10.1.0/lib/node_modules/typescript/lib/tsc.js:37393:29)
    at checkBinaryExpression (/home/andy/.nvm/versions/node/v10.1.0/lib/node_modules/typescript/lib/tsc.js:37385:20)
    at checkExpressionWorker (/home/andy/.nvm/versions/node/v10.1.0/lib/node_modules/typescript/lib/tsc.js:37867:28)

CC Nathan Shively-Sanders (@sandersn)

Activity

  1. mhegazy commented on Jun 14, 2018

    @mhegazy
    Contributor
  2. sandersn commented on Jun 14, 2018

    @sandersn
    Member

    The assert is the one that detects duplicated jsdoc tags. () => 0 is getting doc added twice.

  3. added
    Fixed
    on Jun 14, 2018
  4. MLoughry commented on Jun 26, 2018

    @MLoughry

    Is there any plan to release a 2.9.3 with this fix?

  5. larssn commented on Aug 8, 2018

    @larssn

    Pretty please?

  6. RyanCavanaugh commented on Aug 8, 2018

    @RyanCavanaugh
    Member

    TypeScript 3.0 is out, which contains a fix for this issue and doesn't have any major breaking changes associated with it. I'd recommend upgrading to that version as we don't plan to backport a new 2.9 release at this time.

  7. larssn commented on Aug 9, 2018

    @larssn

    Thanks Ryan, we're stuck using 2.9.2 due to Angular 6 though. Thanks anyway.

  8. rodrigoEclipsa commented on Aug 10, 2018

    @rodrigoEclipsa

    I'm also with angular 6, can we solve it in some way?

  9. ClemensSchneider commented on Sep 14, 2018

    @ClemensSchneider

    Just in the progress of upgrading from Angular 5 to 6 and stumbled upon this issue, too. As there aren't any plans for Angular 6 to be upgraded to TypeScript 3 and there aren't any plans to backport this fix to the TypeScript 2.9 branch it seems that there isn't any chance to upgrade to Angular 6 :(

    More detailed: Having a dependency on autobahn.js which depends on crypto-js which causes this issue.

  10. mrowles commented on Oct 15, 2018

    @mrowles

    Does anyone have a fix for angular@6 yet? I don't have any double assignments, it's referencingcrypto-js@^3.1.9-1 for me (a dependency of amazon-cognito-identity-js).

  11. 9 remaining items

  12. sandersn commented on Oct 17, 2018

    @sandersn
    Member

    Matthew Rowles (@mrowles) Can you try something like

    $ cd node_modules/crypto-js
    $ npm install
    $ npm run build     # I needed to install grunt first
    

    I suspect that the version installed from github doesn't have files in the right places.

    It's also possible that 3.1.9-1 didn't get installed in the top-level node_modules, but underneath amazon-cognito-identity, and that the github-installed version isn't being resolved at all.

  13. d2kx commented on Oct 17, 2018

    @d2kx

    FWIW, I did a very brief test with a straight-forward upgrade to Angular 7.0.0-rc.1, Angular CLI 7.0.0-rc.3 and TypeScript 3.1.x with an AWS-Amplify/crypto-js project that failed before and it actually works now.

  14. mrowles commented on Oct 18, 2018

    @mrowles

    Wonder what is different? I upgraded to the following and still no luck, exactly the same errors (even after a clean npm install):

    "dependencies": {
      "@angular/animations": "7.0.0-rc.1",
      "@angular/cdk": "7.0.0-rc.1",
      "@angular/common": "7.0.0-rc.1",
      "@angular/compiler": "7.0.0-rc.1",
      "@angular/core": "7.0.0-rc.1",
      "@angular/forms": "7.0.0-rc.1",
      "@angular/platform-browser": "7.0.0-rc.1",
      "@angular/platform-browser-dynamic": "7.0.0-rc.1",
      "@angular/platform-server": "7.0.0-rc.1",
      "@angular/router": "7.0.0-rc.1",
      "aws-amplify": "1.1.6",
      ...
      "crypto-js": "^3.1.9-1",
      ...
    },
    "devDependencies": {
      "@angular-devkit/build-angular": "0.8.5",
      "@angular-devkit/build-optimizer": "0.8.5",
      "@angular/cli": "7.0.0-rc.3 ",
      "@angular/compiler-cli": "7.0.0-rc.1",
      "@angular/language-service": "7.0.0-rc.1",
      "@types/crypto-js": "3.1.43",
      ...
      "typescript": "3.1.3",
      ...
    }
    

    I also tried to use Nathan Shively-Sanders (@sandersn) PR sha to no avail :(

  15. mrowles commented on Oct 18, 2018

    @mrowles

    I have updated the following packages and my errors have changed, so possibly resolving the previous problems in case it works for the others:

    devDependencies: {
      "@angular-devkit/build-optimizer": "0.9.0-rc.3",
      "@ngtools/webpack": "7.0.0-rc.3",
      "uglifyjs-webpack-plugin": "2.0.1",
    }
    

    My errors are now potentially related to something else:

    ERROR in ./node_modules/amazon-cognito-identity-js/es/CognitoUser.js
    Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js):
    TypeError: Cannot read property 'flags' of undefined
        at isRelatedTo (/Users/username/workspace/project/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:40600:28)
    

    I've installed amazon-cognito-identity-js@3.0.3 which still didn't fix this issue, but this might be a config issue with webpack or some such, i'll keep digging.

  16. sandersn commented on Oct 18, 2018

    @sandersn
    Member

    Well, it’s still a crash in tsc, but in a different place. Can you run node <tsc-path-inside-angular-devkit> —version and see if or something newer?

  17. mrowles commented on Oct 18, 2018

    @mrowles

    Nathan Shively-Sanders (@sandersn) It is using 8.9.4, so I downgraded my version to the same (from 9.x) but still no luck.

  18. mrowles commented on Oct 19, 2018

    @mrowles

    With the actual release of angular@7 today, along with @ngtools/webpack@7.0.1 + @angular-devkit/build-optimizer@0.10.1 - this is now working!

    Big thanks to Nathan Shively-Sanders (@sandersn) for the help dude!

  19. stormit-vn commented on Oct 19, 2018

    @stormit-vn

    Thank you all for your help. We now able to build the bundler.

    Cheers!

  20. MikeAlexMartinez commented on Apr 30, 2019

    @MikeAlexMartinez

    Is there a fix for this issue if you are still using Angular v6?

  21. JamDoughnnut commented on Nov 11, 2020

    @JamDoughnnut

    For Angular v6 try version 3.1.2-2

  22. chenghongm commented on Nov 17, 2021

    @chenghongm

    following Andy (Andrewkraft) (@Andy-MS) comment, I manually broken down all double assignment a= b = c into a= b; b= c in these two files of ./node_modules/crypto-js/core.js and ./node_modules/crypto-js/cipher-core.js; then error gone!!

    my angular version:

    image

  23. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugFixed

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions