UNPKG

@sv-use/core

Version:

A collection of Svelte 5 utilities.

19 lines (18 loc) 739 B
type GetPreviousReturn<T> = { current: T; }; /** * A reactive state of a given state's previous value. * @param getter The state as a getter function. * @note The state is `undefined` until the given state is updated for the first time. * @see https://svelte-librarian.github.io/sv-use/docs/get-previous */ export declare function getPrevious<T>(getter: () => T): GetPreviousReturn<T | undefined>; /** * A reactive state of a given state's previous value. * @param getter The state as a getter function. * @param initial The initial value of the state. * @see https://svelte-librarian.github.io/sv-use/docs/get-previous */ export declare function getPrevious<T>(getter: () => T, initial: T): GetPreviousReturn<T>; export {};