Closed
Description
Compiling the following TSX code crashes tsc
(1.5.3, revision 01244d6):
/// <reference path="typings/react/react.d.ts" />
import React = require('react');
declare module BaseComponent {
var base : React.Component<any, {}>;
export = base;
}
class TestComponent extends React.Component<any, {}> {
render() {
return <BaseComponent />;
}
}
$ tsc --module commonjs --jsx react test.tsx
/path/to/TypeScript/built/local/tsc.js:34402
throw e;
^
TypeError: Cannot read property 'flags' of undefined
at getApparentType (/path/to/TypeScript/built/local/tsc.js:15667:21)
at getPropertyOfType (/path/to/TypeScript/built/local/tsc.js:15750:20)
at getTypeOfPropertyOfType (/path/to/TypeScript/built/local/tsc.js:14696:24)
at getJsxElementAttributesType (/path/to/TypeScript/built/local/tsc.js:19383:46)
at checkJsxOpeningLikeElement (/path/to/TypeScript/built/local/tsc.js:19458:40)
at checkJsxSelfClosingElement (/path/to/TypeScript/built/local/tsc.js:19110:13)
at checkExpressionWorker (/path/to/TypeScript/built/local/tsc.js:21715:28)
at checkExpression (/path/to/TypeScript/built/local/tsc.js:21621:42)
at checkExpressionCached (/path/to/TypeScript/built/local/tsc.js:21568:38)
at /path/to/TypeScript/built/local/tsc.js:20877:32
Environment:
- tsc 1.5.3 (01244d6)
- React 0.13.3
- DefinitelyTyped React definitions (DefinitelyTyped/DefinitelyTyped@71abea7)
- node v0.10.38
I discovered this issue while trying to write type definitions for the Griddle library. I'm new to TypeScript/TSX/React, so I apologize in advance if this is actually a problem with my code or with the React typings. The fact that the compiler crashed (and this is a new feature) suggested reporting here first.