Use native React.ComponentType definition

This commit is contained in:
Drew Hays
2017-07-06 07:36:22 -07:00
parent e97722eb0e
commit abf3f82b72
+6 -9
View File
@@ -107,13 +107,11 @@ declare module 'next/link' {
}
declare module 'next/dynamic' {
type ComponentType<T> = React.StatelessComponent<T> | typeof React.Component;
interface DynamicOptions<TCProps, TLProps> {
loading?: ComponentType<TLProps>;
loading?: React.ComponentType<TLProps>;
ssr?: boolean;
modules?(props: TCProps & TLProps): { [key: string]: Promise<ComponentType<any>> };
render?(props: TCProps & TLProps, modules: { [key: string]: ComponentType<any> }): void;
modules?(props: TCProps & TLProps): { [key: string]: Promise<React.ComponentType<any>> };
render?(props: TCProps & TLProps, modules: { [key: string]: React.ComponentType<any> }): void;
}
class SameLoopPromise<T> extends Promise<T> {
@@ -122,12 +120,11 @@ declare module 'next/dynamic' {
setError(value: any): void;
runIfNeeded(): void;
}
export default function<TCProps, TLProps>(componentPromise: Promise<ComponentType<TCProps>>, options?: DynamicOptions<TCProps, TLProps>): ComponentType<TCProps & TLProps>;
export default function<TCProps, TLProps>(componentPromise: Promise<React.ComponentType<TCProps>>, options?: DynamicOptions<TCProps, TLProps>): React.ComponentType<TCProps & TLProps>;
}
declare module 'next/router' {
import * as url from 'url';
type ComponentType<T> = React.StatelessComponent<T> | 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<any>, err: any } };
readonly components: { [key: string]: { Component: React.ComponentType<any>, 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<boolean>;
replace(url: string, as?: string, options?: EventChangeOptions): Promise<boolean>;
prefetch(url: string): Promise<ComponentType<any>>;
prefetch(url: string): Promise<React.ComponentType<any>>;
// router events
onAppUpdated?(nextRoute: string): void;