UNPKG

svelte-settings

Version:

> [!WARNING] > This project is a work in progress. Do not use it in any of your projects yet.

19 lines (18 loc) 949 B
import { type Readable } from 'svelte/store'; /** * Creates a subscription to a nested part of the store according to the selector. * The subscription only fires when this part changes, and ignores changes to the rest of the store. * * @param selector A function which returns the part of the store to subscribe to. Being a callback allows for type support. * @param isEqual A callback which allows for overriding the equality checks, e.g. for objects. */ export declare function select<T, U>(store: Readable<T>, selector: (s: T) => U, isEqual?: (a: U, b: U) => boolean): Readable<U>; export declare function isStore<T = unknown>(value: unknown): value is { subscribe: (run: (value: T) => void) => unknown; }; type AsyncFn<T> = () => Promise<T>; /** * A helper to convert either a value, a value callback or a Readable to a Readable. */ export declare function toReadable<T>(value: T | Readable<T> | AsyncFn<T>): Readable<T>; export {};