Function Value

  • Create a one-off type token from a value.

    Used for providing default values.

    Type Parameters

    • T

    Parameters

    • value: T

    Returns Type<T>

    class Wizard {
    name = inject(Name, Value("Harry"));
    }

    const wizard = container.resolve(Wizard);
    wizard.name; // => "Harry"

    @NO_SIDE_EFFECTS