Skip to content

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

Closed
@onehorsetown

Description

@onehorsetown

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions