Documents injecute 1.x · Migrating from 0.x
Skip to content

Type Alias: Registered<S, T, R> ​

Registered<S, T, R> = R extends true ? Omit<S, keyof T> & T : S & T

Defined in: src/types.ts:865

Service map S plus the services in T. With R true (the registration passed replace: true), T's services replace the same keys of S, so replacing a service changes its type instead of intersecting the old and the new one.

Type Parameters ​

S ​

S

T ​

T

R ​

R

Example ​

ts
type Added = Registered<{ port: string }, { host: string }, false>; // { port: string } & { host: string }
type Replaced = Registered<{ port: string; host: string }, { port: number }, true>;
// Omit<{ port: string; host: string }, 'port'> & { port: number }

Released under the MIT License.