Skip to content

DI Bag API / index / TokenKey

Type Alias: TokenKey<T> ​

ts
type TokenKey<T> = T extends infer U & {} ? U extends Token<infer K, infer _S> ? K : U extends CollectionToken<infer K, infer _Item> ? K : never : never;

Defined in: tokens.ts:52

Extract the canonical unique-symbol key from a typed token.

Type Parameters ​

Type ParameterDescription
T-

See ​

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

Ordinary services. Checked composition. Explicit ownership.