Skip to content

DI Bag API / index / ChildReplacementAdmission

Type Alias: ChildReplacementAdmission<ServiceRegistrations extends Registrations, ReplacedServiceKeys extends readonly unknown[]> ​

ts
type ChildReplacementAdmission<ServiceRegistrations extends Registrations, ReplacedServiceKeys extends readonly unknown[]> = [SingletonReplacementKeys<ServiceRegistrations, ReplacedServiceKeys>] extends [never] ? unknown : Unsatisfied<SingletonReplacementMessage<SingletonReplacementKeys<ServiceRegistrations, ReplacedServiceKeys>>, {
    readonly serviceKey: SingletonReplacementKeys<ServiceRegistrations, ReplacedServiceKeys>;
}>;

Defined in: lifetime-types.ts:257

Reject child-container replacements whose selected services have a canonical singleton:one-per-container-tree lifetime. Mark those services scoped:one-per-container or use createIndependentContainer.

Type Parameters ​

Type ParameterDescription
ServiceRegistrations-
ReplacedServiceKeys-

See ​

https://dany-fedorov.github.io/di-bag/agent/errors.html#di-bag-singleton-replacement

Ordinary services. Checked composition. Explicit ownership.