Skip to content

kernel/di/token

Defined in: app/src/kernel/di/token.ts:5

Identifies a service in the Container. The type parameter carries the type of the service, so resolve(token) is typed without casts.

T

readonly id: symbol

Defined in: app/src/kernel/di/token.ts:7

Unique identity of the token.

readonly name: string

Defined in: app/src/kernel/di/token.ts:9

Human-readable name used in error messages and diagnostics.

TokenType<K> = K extends Token<infer T> ? T : never

Defined in: app/src/kernel/di/token.ts:18

The service type a Token stands for.

K


TokenTypes<K> = { readonly [I in keyof K]: TokenType<K[I]> }

Defined in: app/src/kernel/di/token.ts:21

Maps a tuple of tokens to the tuple of their service types.

K extends readonly Token<unknown>[]

token<T>(name): Token<T>

Defined in: app/src/kernel/di/token.ts:30

Creates a new token. Two calls with the same name create two different tokens.

T

string

Name for diagnostics, conventionally the interface name.

Token<T>

A frozen token.