Fix react tests w/incorrect weak type assignments
This even includes react.d.ts itself!
This commit is contained in:
parent
c9da70560f
commit
463e385db6
|
@ -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>
|
|||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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/>
|
||||
|
||||
|
||||
|
|
3
tests/lib/react.d.ts
vendored
3
tests/lib/react.d.ts
vendored
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue