Skip to content

DI Bag API / index / CheckedChildContainerLifetimes

Type Alias: CheckedChildContainerLifetimes<R extends Registrations, O extends Registrations, C = never> ​

ts
type CheckedChildContainerLifetimes<R extends Registrations, O extends Registrations, C = never> = [NeedsLifetimeWalk<R, C>] extends [never] ? unknown : [OverrideCaptives<R, O, C>] extends [never] ? unknown : Unsatisfied<`singleton lifetime cannot capture scoped dependency: ${CaptiveText<OverrideCaptives<R, O, C>>}${SeeErrors<'singleton-captures-scoped'>}`, {
    readonly captives: OverrideCaptives<R, O, C>;
}>;

Defined in: lifetime-types.ts:210

Reject singleton providers introduced by a child-container replacement when they capture scoped dependencies.

Type Parameters ​

Type ParameterDescription
R-
O-
C-

See ​

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

Ordinary services. Checked composition. Explicit ownership.