diff --git a/types/react/index.d.ts b/types/react/index.d.ts index b2dc6057cc..8b2654db82 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -286,7 +286,7 @@ declare namespace React { // tslint:enable:unified-signatures forceUpdate(callBack?: () => any): void; - render(): JSX.Element | JSX.Element[] | ReactPortal | string | number | null | false; + render(): ReactNode; // React.Props is now deprecated, which means that the `children` // property is not available on `P` by default, even though you can @@ -421,7 +421,7 @@ declare namespace React { } interface ComponentSpec extends Mixin { - render(): ReactElement | Array> | string | number | null; + render(): ReactNode; [propertyName: string]: any; } @@ -3519,7 +3519,7 @@ declare global { // tslint:disable:no-empty-interface interface Element extends React.ReactElement { } interface ElementClass extends React.Component { - render(): Element | Element[] | React.ReactPortal | string | number | null | false; + render(): React.ReactNode; } interface ElementAttributesProperty { props: {}; } interface ElementChildrenAttribute { children: {}; } diff --git a/types/react/test/index.ts b/types/react/test/index.ts index b9eea759e7..10b4585e00 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -698,3 +698,11 @@ declare var x: React.DOMElement<{ transition: string; }; }, Element>; + +// React 16 should be able to render its children directly +class RenderChildren extends React.Component { + render() { + const { children } = this.props; + return children !== undefined ? children : null; + } +}