From 207710d2a0446e4f5ac7936352ffa7a968b86321 Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Mon, 3 Aug 2015 16:52:18 -0700 Subject: [PATCH] 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 must declare `render(): JSX.Element`. Derived classes can be more specific. This should resolve Microsoft/TypeScript#3928. --- react/react-global.d.ts | 1 + react/react.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/react/react-global.d.ts b/react/react-global.d.ts index 3c1a69e43..4ba7266eb 100644 --- a/react/react-global.d.ts +++ b/react/react-global.d.ts @@ -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; diff --git a/react/react.d.ts b/react/react.d.ts index 5fbad0d22..0ed794f1e 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -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;