UNPKG

@daiso-tech/core

Version:

The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.

29 lines 1.01 kB
/** * @module ExecutionContext */ import {} from "../../utilities/_module.js"; /** * 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. * * @template TValue - The type of value this token will represent * @param id - Unique identifier string for the token (recommend using a descriptive name or UUID) * @returns A new ContextToken with the specified ID and type * * @example * import { contextToken } from "@daiso-tech/core/execution-context/contracts"; * * const userToken = contextToken<User>("user"); * const requestIdToken = contextToken<string>("requestId"); */ export function contextToken(id) { return { id, }; } //# sourceMappingURL=execution-context.contract.js.map