Abstract constructorStatic Readonly fullThe name that will be displayed in exception messages.
Static Optional Readonly ofA class or function returning the target value of this TypeKey.
Static Optional Readonly scopeStatic AsyncResolves to a Promise of the target value, allowing a synchronous resource to depend on an asynchronous one.
Static BuildApplicable when this is a key that resolves to a function, for example
a SubcomponentDefinition or a FactoryKey.
Resolves to the output of the function when called with args.
class UserFactory extends FactoryKey(
(name: string, id: number) => new User(name, id),
) { private _: any }
container.inject({ user: UserFactory.Build(name, id) }, ({ user }) => {
console.log(user.name, user.id)
})
Rest ...args: ArgsStatic CyclicPrevents dependency cycles on src from causing a compilation error.
Static LazyRequests a function returning a lazily-computed value for this key.
Static MapApplies the given transform to the resolved value of this DependencyKey.
class IdNum extends TypeKey<number>() { private _: any }
class IdStr extends TypeKey({
default: IdNum.Map(id => id.toString()),
}) { private _: any }
Static OptionalRequests a value for this key if provided, otherwise undefined.
Static ProviderRequests a function returning this key's output type.
Static UncheckedRequests a value for this key, without compile-time verification of dependencies. An exception will be thrown if the dependency is not available upon request.
Static verification that this key can be resolved synchronously is still performed.
Generated using TypeDoc
Key used to request an instance of Container. This is automatically provided to each container.