Skip to content

DI Bag API / index / Token

Interface: Token<TokenSymbol extends symbol, Service> ​

Defined in: tokens.ts:22

An immutable typed-token handle pairing a canonical symbol with an invariant service contract. Create one with DiBag.createToken(key).forService<Service>().

See ​

https://dany-fedorov.github.io/di-bag/guides/tutorial.html#use-typed-tokens-for-explicit-positional-injection

Extends ​

Type Parameters ​

Type ParameterDescription
TokenSymbolThe unique symbol that is this token's runtime identity.
ServiceThe service type that bindings must produce and that resolution returns.

Properties ​

symbol ​

ts
readonly symbol: TokenSymbol;

Defined in: tokens.ts:25

Ordinary services. Checked composition. Explicit ownership.