Fix react tests w/incorrect weak type assignments

This even includes react.d.ts itself!
This commit is contained in:
Nathan Shively-Sanders 2017-05-24 12:48:13 -07:00
parent c9da70560f
commit 463e385db6
3 changed files with 6 additions and 4 deletions

View file

@ -5,7 +5,7 @@
import React = require('react');
export function makeP<P>(Ctor: React.ComponentClass<P>): React.ComponentClass<P> {
export function makeP<P>(Ctor: React.ComponentClass<P>) {
return class extends React.PureComponent<P, void> {
public render(): JSX.Element {
return (
@ -13,4 +13,5 @@ export function makeP<P>(Ctor: React.ComponentClass<P>): React.ComponentClass<P>
);
}
};
}
}

View file

@ -38,10 +38,10 @@ declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JS
// OK
const e1 = <TestingOptional />
const e2 = <TestingOptional extra-prop/>
const e3 = <TestingOptional y1="hello"/>
const e4 = <TestingOptional y1="hello" y2={1000} />
const e5 = <TestingOptional y1 y3/>
const e6 = <TestingOptional y1 y3 y2={10} />
const e2 = <TestingOptional y1 y3 extra-prop/>

View file

@ -159,7 +159,8 @@ declare namespace __React {
type ReactInstance = Component<any, any> | Element;
// Base component for plain JS classes
class Component<P, S> implements ComponentLifecycle<P, S> {
interface Component<P, S> extends ComponentLifecycle<P, S> { }
class Component<P, S> {
constructor(props?: P, context?: any);
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
setState(state: S, callback?: () => any): void;