Skip to content

Commit 463e385

Browse files
committed
Fix react tests w/incorrect weak type assignments
This even includes react.d.ts itself!
1 parent c9da705 commit 463e385

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

tests/cases/conformance/jsx/tsxGenericAttributesType9.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55

66
import React = require('react');
77

8-
export function makeP<P>(Ctor: React.ComponentClass<P>): React.ComponentClass<P> {
8+
export function makeP<P>(Ctor: React.ComponentClass<P>) {
99
return class extends React.PureComponent<P, void> {
1010
public render(): JSX.Element {
1111
return (
1212
<Ctor {...this.props } />
1313
);
1414
}
1515
};
16-
}
16+
}
17+

tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload1.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JS
3838

3939
// OK
4040
const e1 = <TestingOptional />
41-
const e2 = <TestingOptional extra-prop/>
4241
const e3 = <TestingOptional y1="hello"/>
4342
const e4 = <TestingOptional y1="hello" y2={1000} />
4443
const e5 = <TestingOptional y1 y3/>
4544
const e6 = <TestingOptional y1 y3 y2={10} />
45+
const e2 = <TestingOptional y1 y3 extra-prop/>
4646

4747

tests/lib/react.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ declare namespace __React {
159159
type ReactInstance = Component<any, any> | Element;
160160

161161
// Base component for plain JS classes
162-
class Component<P, S> implements ComponentLifecycle<P, S> {
162+
interface Component<P, S> extends ComponentLifecycle<P, S> { }
163+
class Component<P, S> {
163164
constructor(props?: P, context?: any);
164165
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
165166
setState(state: S, callback?: () => any): void;

0 commit comments

Comments
 (0)