Resolve method for static and instance Dependency Injection Container.

interface ITSinjexResolve {
    resolve<T>(identifier: string, necessary?: boolean): undefined | T;
    resolve<T>(identifier: string, necessary?: true): T;
    resolve<T>(identifier: string, necessary?: false): undefined | T;
}

Hierarchy (view full)

Methods

Methods

  • Resolve a dependency

    Type Parameters

    • T

    Parameters

    • identifier: string

      The identifier of the dependency

    • Optionalnecessary: boolean

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

    Returns undefined | T

    The resolved dependency or undefined if the dependency is not found

  • Resolve a necessary dependency.

    Type Parameters

    • T

    Parameters

    • identifier: string

      The identifier of the dependency.

    • Optionalnecessary: true

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

    Returns T

    The resolved dependency.

    Error if the dependency is not found.

  • Resolve a non necessary dependency

    Type Parameters

    • T

    Parameters

    • identifier: string

      The identifier of the dependency

    • Optionalnecessary: false

      Not necessary, does not throw an error if the dependency is not found.

    Returns undefined | T

    The resolved dependency or undefined if the dependency is not found