Resolve a dependency.

The identifier used to register the class in the DI container.

Identifier for more information on identifiers.

If true, throws an error if the dependency is not found.

The resolved dependency or undefined if the dependency is not necessary and not found, or throws an error if the dependency is necessary and not found.

A DependencyResolutionError if the dependency is not found and necessary.

  • Resolve a dependency.

    Type Parameters

    • T

    Parameters

    • identifier: string

      The identifier used to register the class in the DI container.

    Returns T

    The resolved dependency.

    Identifier for more information on identifiers.

    A DependencyResolutionError if the dependency is not found.

  • Resolve a dependency

    Type Parameters

    • T

    Parameters

    • identifier: string

      The identifier used to register the class in the DI container.

    • necessary: false

      The dependency is not necessary.

    Returns T | undefined

    The resolved dependency or undefined if the dependency is not found.

    Identifier for more information on identifiers.