From abf3f82b727b80fc73e20641f24af02e5451b2f8 Mon Sep 17 00:00:00 2001 From: Drew Hays Date: Thu, 6 Jul 2017 07:34:14 -0700 Subject: [PATCH] Use native React.ComponentType definition --- types/next/index.d.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 7f8eb6b18f..436914fd5d 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -107,13 +107,11 @@ declare module 'next/link' { } declare module 'next/dynamic' { - type ComponentType = React.StatelessComponent | typeof React.Component; - interface DynamicOptions { - loading?: ComponentType; + loading?: React.ComponentType; ssr?: boolean; - modules?(props: TCProps & TLProps): { [key: string]: Promise> }; - render?(props: TCProps & TLProps, modules: { [key: string]: ComponentType }): void; + modules?(props: TCProps & TLProps): { [key: string]: Promise> }; + render?(props: TCProps & TLProps, modules: { [key: string]: React.ComponentType }): void; } class SameLoopPromise extends Promise { @@ -122,12 +120,11 @@ declare module 'next/dynamic' { setError(value: any): void; runIfNeeded(): void; } - export default function(componentPromise: Promise>, options?: DynamicOptions): ComponentType; + export default function(componentPromise: Promise>, options?: DynamicOptions): React.ComponentType; } declare module 'next/router' { import * as url from 'url'; - type ComponentType = React.StatelessComponent | typeof React.Component; interface EventChangeOptions { shallow?: boolean; @@ -140,7 +137,7 @@ declare module 'next/router' { ready(cb: RouterCallback): void; // router properties - readonly components: { [key: string]: { Component: ComponentType, err: any } }; + readonly components: { [key: string]: { Component: React.ComponentType, err: any } }; readonly pathname: string; readonly route: string; readonly asPath: string; @@ -151,7 +148,7 @@ declare module 'next/router' { back(): void; push(url: string, as?: string, options?: EventChangeOptions): Promise; replace(url: string, as?: string, options?: EventChangeOptions): Promise; - prefetch(url: string): Promise>; + prefetch(url: string): Promise>; // router events onAppUpdated?(nextRoute: string): void;