export declare type RenderFn = (nextProps: Props) => Root; export declare type UpdateFn = (partialNextProps?: Partial) => Root; export declare type Subscription = (value: V) => void; export declare type SubscriptionTypes = { update: Subscription; destroy: Subscription; }; declare type UnsubscribeFn = () => void; export interface Root { displayName: string; /** * Resolves once the hooks has rendered. * Might resolve after being intermediately suspended. */ value: Promise; /** * Resolves once all side effects have run (cleanups, useLayoutEffects and useEffects) */ effects: Promise; /** * Returns the current value of the ran hook (outermost custom `useXYZ` hook) * This might return undefined or a stole/older value while the hook is suspended. * Recommended: Use the value promise to get the latest value. */ currentValue?: HookValue; /** * While the hook is suspended, this will return true */ isSuspended: boolean; /** * If the hook was destroyed (by error or externally), this will return true */ isDestroyed: boolean; /** * Resolves after all cleanup functions have run */ isDestroyedPromise: Promise | undefined; /** * Re-run the hook with new props */ render: RenderFn; /** * Re-run the hook with (partially) new props. */ update: UpdateFn; /** * Subscribe to hook updates */ on: (type: T, subscription: SubscriptionTypes[T]) => UnsubscribeFn; /** * Unsubscribe from hook updates */ off: (type: T, subscription: SubscriptionTypes[T]) => void; /** * Destroy the hook. * This will run all cleanup functions and reject the value promise */ destroy(reason?: unknown): Promise; } export {};