export type DataResultValue = { kind: 'value'; value: unknown; }; export type DataResultError = { kind: 'error'; error: unknown; }; export type DataResultPending = { kind: 'pending'; }; export type DataResultRunning = { kind: 'running'; }; export type DataResultMissing = { kind: 'missing'; }; /** * Where a key has got to: nothing has asked for it, something is waiting on it, its getter is in flight, * or how that getter settled. Tagged so that a getter returning `undefined` or an `Error` stays a value. */ export type DataResult = DataResultValue | DataResultError | DataResultPending | DataResultRunning | DataResultMissing; /** * A set of values that live and die together. A link owns one for whatever it points at, and the current * navigation owns one. */ export type DataStore = { /** * The value for a key, whether or not anything has computed it yet. Subscribing to a key nobody has set * leaves a promise waiting for whoever does. */ subscribe: (key: string) => Promise; /** * Computes a key, unless something already has. A key promoted from another store while its getter is * still running is left alone, so navigation adopts it rather than computing it a second time. */ set: (key: string, getter: () => unknown) => void; /** * What is known about a key, without waiting for it. Reactive, and readable during render. */ get: (key: string) => DataResult; /** * Ends the store. Every value is rejected so that anything waiting on one resumes rather than staying * suspended, then discarded. */ dispose: (reason: Error) => void; }; export declare function createDataStore(): DataStore;