UNPKG

1.41 kBTypeScriptView Raw
1import React from 'react';
2export declare type LoaderComponent<P = {}> = Promise<React.ComponentType<P> | {
3 default: React.ComponentType<P>;
4}>;
5export declare type Loader<P = {}> = (() => LoaderComponent<P>) | LoaderComponent<P>;
6export declare type LoaderMap = {
7 [mdule: string]: () => Loader<any>;
8};
9export declare type LoadableGeneratedOptions = {
10 webpack?(): any;
11 modules?(): LoaderMap;
12};
13export declare type LoadableBaseOptions<P = {}> = LoadableGeneratedOptions & {
14 loading?: ({ error, isLoading, pastDelay, }: {
15 error?: Error | null;
16 isLoading?: boolean;
17 pastDelay?: boolean;
18 retry?: () => void;
19 timedOut?: boolean;
20 }) => JSX.Element | null;
21 loader?: Loader<P> | LoaderMap;
22 loadableGenerated?: LoadableGeneratedOptions;
23 ssr?: boolean;
24};
25export declare type LoadableOptions<P = {}> = LoadableBaseOptions<P>;
26export declare type DynamicOptions<P = {}> = LoadableBaseOptions<P>;
27export declare type LoadableFn<P = {}> = (opts: LoadableOptions<P>) => React.ComponentType<P>;
28export declare type LoadableComponent<P = {}> = React.ComponentType<P>;
29export declare function noSSR<P = {}>(LoadableInitializer: LoadableFn<P>, loadableOptions: LoadableOptions<P>): React.ComponentType<P>;
30export default function dynamic<P = {}>(dynamicOptions: DynamicOptions<P> | Loader<P>, options?: DynamicOptions<P>): React.ComponentType<P>;