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

TypeError: Cannot read property 'kind' of undefined #27214

Closed
onehorsetown opened this issue Sep 19, 2018 · 4 comments
Closed

TypeError: Cannot read property 'kind' of undefined #27214

onehorsetown opened this issue Sep 19, 2018 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@onehorsetown
Copy link

onehorsetown commented Sep 19, 2018

TypeScript Version: 3.1.0-dev.20180919

Search Terms:
Cannot read property 'kind' of undefined

Code

enum Color {
  RED,
  BLUE
}

class Thing {
  public color: Color;

  public constructor() {
    this.color = Color.RED;
  }
}

Expected behavior:
Compiles fine in 3.0.3

Actual behavior:
tsc --strict bug.ts -> crashes compiler

Only with --strict (specifically --strictNullChecks AND --strictPropertyInitialization)

TypeError: Cannot read property 'kind' of undefined
at isConstraintPosition
at getConstraintForLocation
at getInitialOrAssignedType
at getTypeAtFlowAssignment
...

Playground Link:
https://bit.ly/2MJaboV

Does not crash though. Compiles fine with TS 3.0.3

Related Issues:
#27092
#26153

@onehorsetown
Copy link
Author

PR fix for #26433 does not fix this issue.

@j-oliveras
Copy link
Contributor

Duplicate of #26978.

Trick: to search for crashes is better search by top callstack function (in this case isConstraintPosition).

@ghost ghost added the Duplicate An existing issue was already created label Sep 20, 2018
@j-oliveras
Copy link
Contributor

@weswigham this is fixed by your #27246 (tested with nigthly 3.1.0-dev.20180921).

@onehorsetown
Copy link
Author

Confirmed fixed in 3.1.0-dev.20180921

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants