Function Injectable

  • Decorator for adding additional tokens to a class when registering.

    Type Parameters

    • This extends object

    Parameters

    Returns ClassDecorator<Constructor<This>>

    ⁤@Injectable(Weapon)
    class Wand {}

    container.register(Wand);

    // Under the hood
    [Wand, Weapon].forEach((token) => {
    container.register(
    token,
    {useClass: Wand},
    );
    });

    @NO_SIDE_EFFECTS