UNPKG

792 BTypeScriptView Raw
1import React, { Context, ComponentType } from 'react';
2import { ResolverOptions } from '@shopify/async';
3import { AsyncComponentType } from './types';
4interface Options<Value> extends ResolverOptions<Value> {
5}
6interface ProviderProps {
7 children?: React.ReactNode;
8}
9interface ConsumerProps<Value> {
10 children(value: Value | null): React.ReactNode;
11}
12export interface AsyncContextType<Value> {
13 Context: React.Context<Value | null>;
14}
15export interface AsyncContextType<Value> extends AsyncComponentType<Value, never, {}, {}, {}> {
16 Context: Context<Value | null>;
17 Provider: ComponentType<ProviderProps>;
18 Consumer: ComponentType<ConsumerProps<Value>>;
19}
20export declare function createAsyncContext<Value>({ id, load, }: Options<Value>): AsyncContextType<Value>;
21export {};