Add tests and fix broken test

This commit is contained in:
Kanchalai Tanglertsampan
2017-01-27 15:23:51 -08:00
parent 81730dfd22
commit d79f340d57
7 changed files with 19 additions and 16 deletions
+2 -2
View File
@@ -168,7 +168,7 @@ declare namespace React {
setState<K extends keyof S>(f: (prevState: S, props: P) => Pick<S, K>, callback?: () => any): void;
setState<K extends keyof S>(state: Pick<S, K>, callback?: () => any): void;
forceUpdate(callBack?: () => any): void;
render(): JSX.Element | null;
render(): JSX.Element;
// React.Props<T> is now deprecated, which means that the `children`
// property is not available on `P` by default, even though you can
@@ -2624,7 +2624,7 @@ declare global {
type Element = JSXElement | null;
interface ElementClass extends React.Component<any, any> {
render(): JSX.Element | null;
render(): JSX.Element;
}
interface ElementAttributesProperty { props: {}; }
+3
View File
@@ -32,3 +32,6 @@ StatelessComponent2.defaultProps = {
</text>
</g>
</svg>;
const CustomComponent = (props: { flag: boolean }) => props.flag ? React.createElement('div') : null;
const UseComponent2 = (f: boolean) => <CustomComponent flag={f} />;