Skip to content

DI Bag API / index / CheckedLifetimes

Type Alias: CheckedLifetimes<R extends Registrations, C extends NeedConstraint> ​

ts
type CheckedLifetimes<R extends Registrations, C extends NeedConstraint> = [NeedsLifetimeWalk<R, C>] extends [never] ? unknown : [Captives<R, C>] extends [never] ? unknown : unknown extends CheckDependencyCompatibility<R> & CheckDependencyCompleteness<R> & CheckedConstraints<C, R> & CompleteConstraints<C, R> ? Unsatisfied<`singleton lifetime cannot capture scoped dependency: ${CaptiveText<Captives<R, C>>}${SeeErrors<'singleton-captures-scoped'>}`, {
    readonly captives: Captives<R, C>;
}> : unknown;

Defined in: lifetime-types.ts:198

Reject strict singleton providers that transitively capture scoped dependencies.

Type Parameters ​

Type ParameterDescription
R-
C-

See ​

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

Ordinary services. Checked composition. Explicit ownership.