Skip to content

Crash with "Cannot read property 'constraint' of undefined" in latest Nightly #23741

@zombie

Description

@zombie

TypeScript Version: 2.9.0-dev.20180425

Code

Note: if the code doesn't make sense, that's because it's a reduced test case from Firefox source.

class SchemaAPIManager extends EventEmitter {
  _createExtGlobal() {
    let global = {};
    Object.assign(global, {
      extensions: this,
    });
  }
}

Trying to compile above using:

..\TypeScript\node_modules\.bin\tsc -t es6 sample.ts

Actual behavior:

TypeError: Cannot read property 'constraint' of undefined
    at getConstraintDeclaration (D:\git\TypeScript\node_modules\typescript\lib\tsc.js:26581:76)
    at isTypeParameterWithKeyofConstraint (D:\git\TypeScript\node_modules\typescript\lib\tsc.js:36496:45)
    at isLiteralOfContextualType (D:\git\TypeScript\node_modules\typescript\lib\tsc.js:36510:28)
    at getWidenedLiteralLikeTypeForContextualType (D:\git\TypeScript\node_modules\typescript\lib\tsc.js:30001:18)
    at checkExpressionForMutableLocation (D:\git\TypeScript\node_modules\typescript\lib\tsc.js:36530:17)
    at checkPropertyAssignment (D:\git\TypeScript\node_modules\typescript\lib\tsc.js:36536:20)
    at checkObjectLiteral (D:\git\TypeScript\node_modules\typescript\lib\tsc.js:33125:58)
    at checkExpressionWorker (D:\git\TypeScript\node_modules\typescript\lib\tsc.js:36632:28)
    at checkExpression (D:\git\TypeScript\node_modules\typescript\lib\tsc.js:36584:42)
    at checkExpressionWithContextualType (D:\git\TypeScript\node_modules\typescript\lib\tsc.js:36449:26)

This doesn't seem to throw on previous stable version 2.8.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions