WorkflowCtx

Type Alias: WorkflowCtx<TExtensions>

ts
type WorkflowCtx<TExtensions> = Ctx<any, any, 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:

plaintext
async function chargeUser(
  ctx: WorkflowCtx<{ user: User }>,
  amount: number,
) {
  return ctx.step('charge', () => stripe.charge(amount, ctx.user.id))
}
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