Function Build

  • Create a one-off type token from a factory function.

    Type Parameters

    • Value

    Parameters

    • factory: ((...args: []) => Value)
        • (...args): Value
        • Parameters

          • Rest...args: []

          Returns Value

    Returns Type<Value>

    class Wizard {
    wand = inject(
    Build(() => {
    const wand = inject(Wand);
    wand.owner = this;
    // ...
    return wand;
    }),
    );
    }

    @NO_SIDE_EFFECTS