@lppedd/di-wise-neo - v0.23.1
    Preparing search index...

    Function Inject

    • Parameter decorator that injects the instance associated with the given class.

      Throws an error if:

      • The class is not registered in the container.
      • A circular dependency is detected.

      Use injectBy when you need to resolve circular dependencies.

      Type Parameters

      • Instance extends object

      Parameters

      Returns ParameterDecorator

    • Parameter decorator that injects the value associated with the given token.

      Throws an error if:

      • The token is not registered in the container.
      • A circular dependency is detected.

      Use injectBy when you need to resolve circular dependencies.

      Type Parameters

      • Value

      Parameters

      Returns ParameterDecorator

    • Parameter decorator that injects the value associated with the given token.

      This overload allows referencing a token declared later in the file by using the tokenRef helper function.

      Throws an error if:

      • The token is not registered in the container.
      • A circular dependency is detected.

      Use function injection with injectBy when you need to resolve circular dependencies.

      Example:

      class Wizard {
      constructor(@Inject(tokenRef(() => Wand)) readonly wand: Wand) {}
      }
      // Other code...
      class Wand {}

      Type Parameters

      • Value

      Parameters

      Returns ParameterDecorator