Documents injecute 1.x · Migrating from 0.x
Skip to content

Type Alias: Dependency<S, A> ​

Dependency<S, A> = keyof S | keyof A | OptionalDependency | CollectDependency | (() => any)

Defined in: src/types.ts:83

What a registration can depend on:

  • a service key: the factory receives that service
  • optional(key): the service, or undefined when it is not registered
  • collect(tag): every service registered under the tag, in registration order
  • a function: called on each resolution, the factory receives its result

A is a registry's own additions, on top of the services S it was given (see ServiceRegistry).

(() => any rather than () => unknown keeps typos in keys reported on the key itself.)

Type Parameters ​

S ​

S

A ​

A = { }

Released under the MIT License.