Function inject

Registers an injection for dependency injection.

  • Parameters

    • OptionaldependencyId: DependencyId | DependencyClass<any>

      Optional dependency identifier. If omitted, the property name is used.

    • scope: ResolveScope = ...

      Optional scope to control where to search for dependency. Defaults to Current | Parent.

    Returns (_value: unknown, context: ClassFieldDecoratorContext) => void

    A decorator function for class fields.

    The decorated field will receive its dependency from the same container as the injection owner.