Skip to content

useDependency

github-actions[bot] edited this page Dec 3, 2024 · 3 revisions
API / useDependency hook

This hook has multiple overloads.


Resolves the requested dependency using the resolver in the current context.

function useDependency<T>(
  dependency: ResolvableSimpleDependency<T>
): T

Source reference: src/dependencies/UseDependency.ts:26.

Generic Parameters

  • T - The dependency type to resolve.

Parameters

Returns: T

Returns the resolved dependency.

See also


Resolves the requested complex dependency using the resovler in the current context.

function useDependency<T, TAdditional extends readonly any[]>(
  dependency: ComplexDependency<T, TAdditional>,
  additionalDependencies: TAdditional
): T

Source reference: src/dependencies/UseDependency.ts:47.

Generic Parameters

  • T - The dependency type to resolve.

  • TAdditional - A tuple representing additional parameters required by the constructor.

    Type constraints: readonly any[].

Parameters

  • dependency: ComplexDependency<T, TAdditional>
    The complex dependency to resolve.

  • additionalDependencies: TAdditional
    Additional constructor arguments which also act as dependencies, if one of them changes the dependency will be reinitialized.

Returns: T

Returns the resolved dependency.

See also

Clone this wiki locally