Skip to content

"Cannot read property 'flags' of undefined" error when compiling nested array destruction #5389

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

Closed
seanchas116 opened this issue Oct 24, 2015 · 1 comment · Fixed by #5397
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this

Comments

@seanchas116
Copy link
Contributor

Hi,

I found tsc crashes when compiling nested array destruction in function parameter (example below).

TypeScript version

1.8.0-dev.20151024 (installed via npm install typescript@next)

Example Source

const nestedArray = [[[1, 2]], [[3, 4]]];

nestedArray.forEach(([[a, b]]) => {
  console.log(a, b);
});

Command

tsc index.ts

Trace

/Users/seanchas116/Repos/seanchas116/typescript-destructuring-test/node_modules/typescript/lib/tsc.js:30338
                throw e;
                ^

TypeError: Cannot read property 'flags' of undefined
    at getSymbolLinks (/Users/seanchas116/Repos/seanchas116/typescript-destructuring-test/node_modules/typescript/lib/tsc.js:10715:23)
    at assignBindingElementTypes (/Users/seanchas116/Repos/seanchas116/typescript-destructuring-test/node_modules/typescript/lib/tsc.js:17679:25)
    at assignTypeToParameterAndFixTypeParameters (/Users/seanchas116/Repos/seanchas116/typescript-destructuring-test/node_modules/typescript/lib/tsc.js:17689:17)
    at assignContextualParameterTypes (/Users/seanchas116/Repos/seanchas116/typescript-destructuring-test/node_modules/typescript/lib/tsc.js:17666:17)
    at checkFunctionExpressionOrObjectLiteralMethod (/Users/seanchas116/Repos/seanchas116/typescript-destructuring-test/node_modules/typescript/lib/tsc.js:17860:29)
    at checkExpressionWorker (/Users/seanchas116/Repos/seanchas116/typescript-destructuring-test/node_modules/typescript/lib/tsc.js:18503:28)
    at checkExpression (/Users/seanchas116/Repos/seanchas116/typescript-destructuring-test/node_modules/typescript/lib/tsc.js:18445:42)
    at checkExpressionWithContextualType (/Users/seanchas116/Repos/seanchas116/typescript-destructuring-test/node_modules/typescript/lib/tsc.js:18399:26)
    at checkApplicableSignature (/Users/seanchas116/Repos/seanchas116/typescript-destructuring-test/node_modules/typescript/lib/tsc.js:17162:31)
    at chooseOverload (/Users/seanchas116/Repos/seanchas116/typescript-destructuring-test/node_modules/typescript/lib/tsc.js:17448:30)
@mhegazy
Copy link
Contributor

mhegazy commented Oct 27, 2015

thanks @seanchas116!

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants