UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

21 lines (20 loc) 779 B
/** * A Deferred object represents a Promise that can be resolved or rejected * from outside the Promise constructor. */ export interface Deferred<T> { /** The Promise object being controlled */ promise: Promise<T>; /** Function to resolve the Promise with a value or another Promise */ resolve: (value: T | PromiseLike<T>) => void; /** Function to reject the Promise with an error */ reject: (reason?: Error | unknown) => void; /** Check if the Promise has been resolved or rejected */ isPending: () => boolean; } /** * Creates a Deferred object containing a Promise and methods to control it. * * @returns A Deferred object with promise, resolve, reject, and isPending methods */ export declare function createDeferred<T>(): Deferred<T>;