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

Compiler crashes with Cannot read property 'kind' of undefined #29661

Closed
ttv86 opened this issue Jan 31, 2019 · 3 comments
Closed

Compiler crashes with Cannot read property 'kind' of undefined #29661

ttv86 opened this issue Jan 31, 2019 · 3 comments
Assignees
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Duplicate An existing issue was already created

Comments

@ttv86
Copy link

ttv86 commented Jan 31, 2019

TypeScript Version:
Tested on both 3.2.2 & 3.4.0-dev.20190131

Search Terms:
Cannot read property 'kind' of undefined

Code
Got reduced the error down to this: When there are 2 files in compilation, and other contains some command, but isn't called, whole TypeScript compiler crashes on an exception.

HistTest.zip
Extract attached zip file to the directory, run "npm install" and then "webpack"

Expected behavior:
Either clear error what went wrong or a successful compilation.

Actual behavior:
Webpack throws an exception:
TypeError: Cannot read property 'kind' of undefined
at Object.isBinaryExpression (c:....\node_modules\typescript\lib\typescript.js:13389:21)
at getTypeReferenceTypeWorker (c:....\node_modules\typescript\lib\typescript.js:38553:51)

Related Issues:
#29365
#28810

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Feb 5, 2019
@RyanCavanaugh RyanCavanaugh added the Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output label Feb 5, 2019
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.4.0 milestone Feb 5, 2019
@cancerberoSgx
Copy link

cancerberoSgx commented Feb 27, 2019

Don't know if is the same cause, but I'm having the same error with the following code that, although is weird, tsc is not emitting any diagnostics and it crash without stacktrace (was able to get a stacktrace with ts-node).


class C<S> {
  a={}
  m(s: S) {
    const b = { ...this.a, ...s } = {   }
  }
}


/home/sg/git/jsx-alone/jsx-alone-dom-extra/node_modules/typescript/lib/tsc.js:71491
                throw e;
                ^

TypeError: Cannot read property 'kind' of undefined
    at Object.isIdentifier (/home/sg/git/jsx-alone/jsx-alone-dom-extra/node_modules/typescript/lib/tsc.js:10382:21)
    at getLiteralTypeFromPropertyName (/home/sg/git/jsx-alone/jsx-alone-dom-extra/node_modules/typescript/lib/tsc.js:32924:23)
    at Object.map (/home/sg/git/jsx-alone/jsx-alone-dom-extra/node_modules/typescript/lib/tsc.js:378:29)
    at getRestType (/home/sg/git/jsx-alone/jsx-alone-dom-extra/node_modules/typescript/lib/tsc.js:29004:47)
    at checkObjectLiteralDestructuringPropertyAssignment (/home/sg/git/jsx-alone/jsx-alone-dom-extra/node_modules/typescript/lib/tsc.js:43034:28)
    at checkObjectLiteralAssignment (/home/sg/git/jsx-alone/jsx-alone-dom-extra/node_modules/typescript/lib/tsc.js:43003:17)
    at checkDestructuringAssignment (/home/sg/git/jsx-alone/jsx-alone-dom-extra/node_modules/typescript/lib/tsc.js:43106:24)
    at checkBinaryLikeExpression (/home/sg/git/jsx-alone/jsx-alone-dom-extra/node_modules/typescript/lib/tsc.js:43186:24)
    at checkBinaryExpression (/home/sg/git/jsx-alone/jsx-alone-dom-extra/node_modules/typescript/lib/tsc.js:43181:20)
    at checkExpressionWorker (/home/sg/git/jsx-alone/jsx-alone-dom-extra/node_modules/typescript/lib/tsc.js:43743:28)


My two cents, keep it up

@sheetalkamat
Copy link
Member

@cancerberoSgx your issue is actually #29610 already reported and unrelated to this issue. Thanks.

@sheetalkamat
Copy link
Member

Duplicate of #28810 which already has PR #29339

@sheetalkamat sheetalkamat added the Duplicate An existing issue was already created label Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants