• Returns a wrapper (for the given store) which only exposes the WritableSignal interface. When the value is changed from the given wrapper, the provided set function is called.

    Type Parameters

    • T

    • W = T

    Parameters

    • store: StoreInput<T>

      store to wrap

    • Optional set: ((value) => void)

      function that will be called when the value is changed from the wrapper (through the set or the update function). If set is not specified, a noop function is used (so the value of the store cannot be changed from the returned wrapper).

        • (value): void
        • Replaces store's state with the provided value.

          Parameters

          • value: W

            value to be used as the new state of a store.

          Returns void

    Returns WritableSignal<T, W>

    A wrapper which only exposes the WritableSignal interface.

  • Returns a wrapper (for the given store) which only exposes the WritableSignal interface and also adds the given extra properties on the returned object.

    Type Parameters

    • T

    • U

    • W = T

    Parameters

    • store: StoreInput<T>

      store to wrap

    • extraProps: U & Partial<Pick<WritableSignal<T, W>, "set" | "update">>

      object containing the extra properties to add on the returned object, and optionally the set and the update function of the WritableSignal interface. If the set function is not specified, a noop function is used.

      If the update function is not specified, a default function that calls set is used.

    Returns WritableSignal<T, W> & Omit<U, keyof WritableSignal<T, W>>

    A wrapper which only exposes the WritableSignal interface and the given extra properties.

Generated using TypeDoc