Skip to content

DI Bag API / index / SealedConstraints

Type Alias: SealedConstraints<C extends NeedConstraint, R extends Registrations, P extends keyof R> ​

ts
type SealedConstraints<C extends NeedConstraint, R extends Registrations, P extends keyof R> = C extends ContributionConstraint ? ModuleContributionConstraints<C, R, P> : C extends LifetimeObligation ? never : C extends {
    readonly kind: 'export' | 'external';
    readonly consumer: infer K extends string | symbol;
    readonly needs: infer N extends object;
} ? Constraint<K, N, Extract<keyof N, P>, 'export'> | Constraint<K, N, Exclude<keyof N, keyof R>, 'external'> : C extends {
    readonly kind: 'token-export' | 'token-external';
    readonly consumer: infer K extends string | symbol;
    readonly token: infer T;
} ? TokenConstraint<K, T, R, P> : C extends {
    readonly kind: 'optional-token-export' | 'optional-token-external';
    readonly consumer: infer K extends string | symbol;
    readonly token: infer T;
} ? TokenConstraint<K, T, R, P, true> : C;

Defined in: module-types.ts:210

Nest every constraint a builder retained from installed modules and contributions when that builder seals into a module with exports P. Needs on an export stay checkable by the host; needs satisfied privately are final and drop; unsatisfied needs remain external requirements of the module.

Type Parameters ​

Type ParameterDescription
C-
R-
P-

See ​

https://dany-fedorov.github.io/di-bag/guides/api-reference.html#provider-and-module-projections

Ordinary services. Checked composition. Explicit ownership.