Closed
Description
TypeScript Version: master branch as of today(may 9th) (a72a9aa)
Code
// (Using react version "15.4.2")
// This is a .js file, using --checkJS (and extra lines were cut out)
// A *self-contained* demonstration of the problem follows...
//
define(function(require) {
'use strict';
const React = require('react');
const { Component } = React;
class Something extends Component {
constructor(props) {
super(props)
this.state = { }; // This overrides a parent property - see https://facebook.github.io/react/docs/react-component.html#state
}
}
return Something;
});
Command used (NOTE: there was no config file used here, just command line flags)
tsc --checkJs --noEmit --allowJs example.js
Expected behavior:
Does not crash
Actual behavior:
Crashes because of the assignment of {}
to this.state (property of parent class Component)
TypeError: Cannot read property 'kind' of undefined
at checkIndexConstraintForProperty (/usr/local/node/lib/node_modules/typescript/lib/tsc.js:36208:61)
at /usr/local/node/lib/node_modules/typescript/lib/tsc.js:36173:21
at Object.forEach (/usr/local/node/lib/node_modules/typescript/lib/tsc.js:288:30)
at checkIndexConstraints (/usr/local/node/lib/node_modules/typescript/lib/tsc.js:36171:20)
at checkClassLikeDeclaration (/usr/local/node/lib/node_modules/typescript/lib/tsc.js:36406:17)
at checkClassDeclaration (/usr/local/node/lib/node_modules/typescript/lib/tsc.js:36324:13)
at checkSourceElement (/usr/local/node/lib/node_modules/typescript/lib/tsc.js:37259:28)
at Object.forEach (/usr/local/node/lib/node_modules/typescript/lib/tsc.js:288:30)
at checkBlock (/usr/local/node/lib/node_modules/typescript/lib/tsc.js:35383:16)
at checkSourceElement (/usr/local/node/lib/node_modules/typescript/lib/tsc.js:37222:28)
This was seen after the fix for #15616 was merged
This happens whether or not PR 15594 is merged (I think)