A strongly-typed key that identifies a service in the container.

Tokens are created with createToken and carry the service type as a phantom parameter, so container.resolve(RPC_TOKEN) always returns SolanaRpc — no casts needed.

1.2.0

interface ServiceToken<T> {
    [___tokenBrand]: "ServiceToken";
    [___tokenType]: T;
    name: string;
}

Type Parameters

  • T = unknown

    The service type this token resolves to.

Properties

[___tokenBrand]

phantom brand — never set at runtime.

[___tokenType]: T

phantom type carrier — never set at runtime.

name: string

Human-readable debug name.