Skip to content

FactoryProvider · Core API

type FactoryProvider<T, TDeps> = object;

Provider that lazily creates a token value from typed dependencies.

deps keys become the properties passed to useFactory, scope controls caching lifetime, and onDispose runs for cached singleton/scoped instances.

Type Parameter Default type

T

‐

TDeps extends DepsMap

Record<never, never>

readonly provide: Token<T>;

Token registered by this provider.


readonly optional deps?: TDeps;

Named dependencies resolved before the factory is called.


readonly optional scope?: Scope;

Caching lifetime for the created value.


readonly useFactory: Factory<T, TDeps>;

Function that creates the token value.


readonly optional onDispose?: DisposeHook<T>;

Cleanup hook for cached values.