RAGS - v1.10.0
    Preparing search index...

    Variable derive

    derive: <
        V,
        const Deps extends Variable<any>[],
        Args extends
            {
                [K in string | number | symbol]: Deps[K] extends Variable<T>
                    ? T
                    : never
            },
    >(
        deps: Deps,
        fn: (...args: Args) => V,
    ) => Variable<V>

    Type Declaration

      • <
            V,
            const Deps extends Variable<any>[],
            Args extends
                {
                    [K in string | number | symbol]: Deps[K] extends Variable<T>
                        ? T
                        : never
                },
        >(
            deps: Deps,
            fn: (...args: Args) => V,
        ): Variable<V>
      • Creates a derived Variable from multiple source Variables.

        Similar to merge but operates on Variables directly rather than Bindings, and returns a Variable instead of a Binding.

        Type Parameters

        • V
        • const Deps extends Variable<any>[]
        • Args extends { [K in string | number | symbol]: Deps[K] extends Variable<T> ? T : never }

        Parameters

        • deps: Deps

          Array of Variables to observe

        • fn: (...args: Args) => V

          Function that receives all current values and returns the derived value

        Returns Variable<V>

        A new Variable containing the derived value