TokenProvider
@tsed/di
Usage
typescript
import { TokenProvider } from "@tsed/di/src/common/interfaces/TokenProvider";Overview
ts
type TokenProvider<T = any> = string | symbol | Type<T> | AbstractType<T> | FactoryTokenProvider<T>;Description
Union type representing all valid provider tokens in the DI system.
A token uniquely identifies a provider in the dependency injection container. Tokens can be strings, symbols, class constructors, or factory tokens with type inference.
Usage
typescript
// String token
const token1: TokenProvider = "MY_SERVICE";
// Symbol token
const token2: TokenProvider = Symbol.for("MY_SERVICE");
// Class token
const token3: TokenProvider = MyService;
// Factory token with inference
const token4 = inject<MyService>();