diff --git a/types/react-router-config/index.d.ts b/types/react-router-config/index.d.ts index 8497b0d4b8..2040a8a721 100644 --- a/types/react-router-config/index.d.ts +++ b/types/react-router-config/index.d.ts @@ -14,7 +14,7 @@ export interface RouteConfigComponentProps extends RouteComponentProps { export interface RouteConfig { location?: Location; - component?: React.SFC | void> | React.ComponentClass | void>; + component?: React.ComponentType | {}>; path?: string; exact?: boolean; strict?: boolean; diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index 5d97ebb71f..82811fadfb 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -64,7 +64,7 @@ export interface RouteComponentProps

{ export interface RouteProps { location?: H.Location; - component?: React.SFC | undefined> | React.ComponentClass | undefined>; + component?: React.ComponentType | {}>; render?: ((props: RouteComponentProps) => React.ReactNode); children?: ((props: RouteComponentProps) => React.ReactNode) | React.ReactNode; path?: string; @@ -99,4 +99,4 @@ export interface match

{ } export function matchPath

(pathname: string, props: RouteProps): match

| null; -export function withRouter

(component: React.SFC & P> | React.ComponentClass & P>): React.ComponentClass

; +export function withRouter

(component: React.ComponentType & P>): React.ComponentClass

; diff --git a/types/react-router/test/examples-from-react-router-website/PreventingTransitions.tsx b/types/react-router/test/examples-from-react-router-website/PreventingTransitions.tsx index bd5d76ae2b..9f1858c89f 100644 --- a/types/react-router/test/examples-from-react-router-website/PreventingTransitions.tsx +++ b/types/react-router/test/examples-from-react-router-website/PreventingTransitions.tsx @@ -22,7 +22,7 @@ const PreventingTransitionsExample = () => ( ); -class Form extends React.Component { +class Form extends React.Component<{}, {isBlocking: boolean}> { state = { isBlocking: false }; diff --git a/types/react/index.d.ts b/types/react/index.d.ts index ab25ae8908..df4a9f5374 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -36,7 +36,7 @@ declare namespace React { // ---------------------------------------------------------------------- type ReactType = string | ComponentType; - type ComponentType

= ComponentClass

| StatelessComponent

; + type ComponentType

= ComponentClass

| StatelessComponent

; type Key = string | number; type Ref = string | ((instance: T | null) => any); diff --git a/types/rrc/index.d.ts b/types/rrc/index.d.ts index 6a56baf3fc..f4ef84e568 100644 --- a/types/rrc/index.d.ts +++ b/types/rrc/index.d.ts @@ -22,10 +22,10 @@ export interface WithScrollOptions { alignToTop?: boolean; } -export type ComponentConstructor = React.ComponentClass | React.SFC; +export type ComponentConstructor = React.ComponentType; -export function withScroll(component: ComponentConstructor | undefined>, options?: WithScrollOptions) - : ComponentConstructor | undefined>; +export function withScroll(component: ComponentConstructor | {}>, options?: WithScrollOptions) + : ComponentConstructor | {}>; export type RouteConfiguration = RouteProps & { inject?: { [key: string]: any } };