/** * A minimal observable store, the primitive every stateful part of the core layer * is built on. * * The `subscribe` / `getSnapshot` pair is deliberately the shape React's * `useSyncExternalStore` expects, and adapts to a Svelte store or an Angular signal. * * @module */ /** Read-only view of a {@linkcode Store}, handed to consumers that only observe. */ export type ReadableStore = { getSnapshot(): T; subscribe(listener: () => void): () => void; }; export type Store = ReadableStore & { /** * Replaces the state. Returning the current state (or an equal one) is a no-op: * no new snapshot is produced and no listener runs. */ setState(update: (current: T) => T): void; }; /** * Creates a store holding `initial`. * * The snapshot keeps its identity until the state actually changes, which is what * stops `useSyncExternalStore` from looping. */ export declare function createStore(initial: T): Store;