Restate Typescript SDK
    Preparing search index...

    A handle to one invocation-scoped slot. Mint it once with contextLocal (at module scope is fine — minting touches no fiber), then get/set it from inside the workflow body.

    interface ContextLocal<T> {
        get: () => T;
        set: (value: T) => void;
    }

    Type Parameters

    • T
    Index

    Properties

    Properties

    get: () => T

    Read this slot's value for the current invocation. Returns the value previously set during this invocation, or the default passed to contextLocal (or undefined if none) when it has not been set. Must be called from generator code on the fiber's synchronous span (a gen body running under execute); calling it from an ops.run closure or other async callback throws.

    set: (value: T) => void

    Set this slot's value for the rest of the current invocation, visible to every fiber under it. Must be called from generator code on the fiber's synchronous span; calling it from an ops.run closure or other async callback throws.