Skip to main content

WorkflowCtx

还没翻译译自英文(tanstack.com)本页 8 段都还没译

Type Alias: WorkflowCtx<TExtensions>

type WorkflowCtx<TExtensions> = Ctx<any, any, TExtensions>;

Defined in: packages/workflow-core/src/types.ts:380

Helper alias for typing functions that only care about middleware extensions — not the calling workflow's specific input / state shape. Common in shared utility helpers:

async function chargeUser(
  ctx: WorkflowCtx<{ user: User }>,
  amount: number,
) {
  return ctx.step('charge', () => stripe.charge(amount, ctx.user.id))
}

For helpers that need typed ctx.input or ctx.state, use the full Ctx<TInput, TState, TExt> directly.

Type Parameters

TExtensions

TExtensions = unknown