1 | import { ReactElement } from 'react';
|
2 | import { Resolver } from '@shopify/async';
|
3 | import { IfAllOptionalKeys } from '@shopify/useful-types';
|
4 | export declare enum AssetTiming {
|
5 | None = 1,
|
6 | NextPage = 2,
|
7 | CurrentPage = 3,
|
8 | Immediate = 4
|
9 | }
|
10 | export interface AsyncComponentType<T, Props extends object, PreloadOptions extends object, PrefetchOptions extends object, KeepFreshOptions extends object> {
|
11 | readonly resolver: Resolver<T>;
|
12 | (props: Props): ReactElement<Props>;
|
13 | Preload(props: PreloadOptions): React.ReactElement<{}> | null;
|
14 | Prefetch(props: PrefetchOptions): React.ReactElement<{}> | null;
|
15 | KeepFresh(props: KeepFreshOptions): React.ReactElement<{}> | null;
|
16 | usePreload(...props: IfAllOptionalKeys<PreloadOptions, [PreloadOptions?], [PreloadOptions]>): () => void;
|
17 | usePrefetch(...props: IfAllOptionalKeys<PrefetchOptions, [PrefetchOptions?], [PrefetchOptions]>): () => void;
|
18 | useKeepFresh(...props: IfAllOptionalKeys<KeepFreshOptions, [KeepFreshOptions?], [KeepFreshOptions]>): () => void;
|
19 | }
|
20 | export declare type PreloadOptions<T> = T extends AsyncComponentType<any, any, infer U, any, any> ? U : never;
|
21 | export declare type PrefetchOptions<T> = T extends AsyncComponentType<any, any, infer U, any, any> ? U : never;
|
22 | export declare type KeepFreshOptions<T> = T extends AsyncComponentType<any, any, infer U, any, any> ? U : never;
|