• IMPORT_PATH: "@daiso-tech/core/execution-context/contracts"

    Factory function that creates a type-safe context token.

    This function creates a new token that can be used to store and retrieve values of a specific type within an execution context. The token acts as a typed key that ensures type safety when working with context values.

    Type Parameters

    • TValue

      The type of value this token will represent

    Parameters

    • id: string

      Unique identifier string for the token (recommend using a descriptive name or UUID)

    Returns ContextToken<TValue>

    A new ContextToken with the specified ID and type

    import { contextToken } from "@daiso-tech/core/execution-context/contracts";

    const userToken = contextToken<User>("user");
    const requestIdToken = contextToken<string>("requestId");