Interface WritableFn<T, Args, R>

Combines a writable Svelte store with a callable function. This type allows a writable store to also act as a function enabling flexible reactive behavior.

interface WritableFn<T, Args extends unknown[], R = void> {
    set(this: void, value: T): void;
    subscribe(
        this: void,
        run: Subscriber<T>,
        invalidate?: Invalidator<T>,
    ): Unsubscriber;
    update(this: void, updater: Updater<T>): void;
    (...args: Args): R;
}

Type Parameters

  • T

    The type of the value stored in the writable store.

  • Args extends unknown[]

    The tuple of argument types accepted by the function.

  • R = void

    The return type of the function.

Hierarchy
  • Parameters

    Returns R

Index
  • Set value and inform subscribers.

    Parameters

    • this: void
    • value: T

      to set

    Returns void

  • Update value using callback and inform subscribers.

    Parameters

    • this: void
    • updater: Updater<T>

      callback

    Returns void