vlocode-project - v2.4.5
    Preparing search index...

    Interface InjectDecorator

    Decorator factory for container-managed constructor and property injection.

    Use @inject(Type) when a dependency should be resolved from the container. Use @inject.new(...args) when the dependency must be constructed as a new instance with explicit constructor arguments.

    interface InjectDecorator {
        new(
            ...args: any[],
        ): (
            target: object,
            propertyKey: string | symbol | undefined,
            parameterIndex?: number,
        ) => any;
        (): PropertyDecorator;
        (
            serviceType: ObjectType | LazyObjectType,
        ): (
            target: object,
            propertyKey: string | symbol | undefined,
            parameterIndex?: number,
        ) => any;
    }
    • Marks a property for lazy injection using the reflected property type.

      This overload is only valid for properties because constructor parameters require an explicit service type.

      Returns PropertyDecorator

    • Marks a property or constructor parameter for injection using the given type.

      Parameters

      Returns (
          target: object,
          propertyKey: string | symbol | undefined,
          parameterIndex?: number,
      ) => any

    Index

    Methods

    Methods

    • Marks a property or constructor parameter to be created as a new instance.

      The target type is taken from emitted decorator metadata. The new instance is created by the active container, so its own dependencies still use the same container context.

      Parameters

      • ...args: any[]

        Constructor arguments passed to the injected type.

      Returns (
          target: object,
          propertyKey: string | symbol | undefined,
          parameterIndex?: number,
      ) => any