React: Include required render() function in base Component class.

The new TSX mode in the TypeScript compiler has the requirements that
the element class constructor produces an element instance type that is
assignable to the type JSX.ElementClass.  To meet this Component<P, S>
must declare `render(): JSX.Element`.  Derived classes can be more
specific.

This should resolve Microsoft/TypeScript#3928.
This commit is contained in:
Nathan Brown
2015-08-03 17:08:03 -07:00
parent 7c27233ae4
commit 207710d2a0
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -136,6 +136,7 @@ declare module React {
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
setState(state: S, callback?: () => any): void;
forceUpdate(): void;
render(): JSX.Element;
props: P;
state: S;
context: any;
+1
View File
@@ -136,6 +136,7 @@ declare module __React {
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
setState(state: S, callback?: () => any): void;
forceUpdate(): void;
render(): JSX.Element;
props: P;
state: S;
context: any;