-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 2.1.0-dev.20160829
With @types/[email protected]
and "strictNullChecks": true
.
Code
// with @types/[email protected]
// SFC returns null: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/11912
import * as React from 'react';
const CustomComponent = (props: { flag: boolean }) => props.flag ? React.createElement('div') : null;
const UseComponent = () => React.createElement(CustomComponent); // works
const UseComponent2 = () => <CustomComponent />; // throws
Expected behavior:
TSX behaves like plain TS.
Actual behavior:
TSX throws
[ts] JSX element type 'DOMElement<{}, Element> | null' is not a constructor function for JSX elements.
Type 'null' is not assignable to type 'ElementClass'.
apexskier, monolithed and dmitriid
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue