mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
fix rendering types for React 16
This commit is contained in:
Vendored
+3
-3
@@ -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<T> 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<P, S> extends Mixin<P, S> {
|
||||
render(): ReactElement<any> | Array<ReactElement<any>> | string | number | null;
|
||||
render(): ReactNode;
|
||||
|
||||
[propertyName: string]: any;
|
||||
}
|
||||
@@ -3519,7 +3519,7 @@ declare global {
|
||||
// tslint:disable:no-empty-interface
|
||||
interface Element extends React.ReactElement<any> { }
|
||||
interface ElementClass extends React.Component<any> {
|
||||
render(): Element | Element[] | React.ReactPortal | string | number | null | false;
|
||||
render(): React.ReactNode;
|
||||
}
|
||||
interface ElementAttributesProperty { props: {}; }
|
||||
interface ElementChildrenAttribute { children: {}; }
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user