Skip to main content

Function: assertValidStageId()

assertValidStageId<W>(workflow, stageId): asserts stageId is WorkflowStageId<W>

Defined in: packages/workflow-engine/src/core/stage-ids.ts:175

Assert that a stage ID exists in a workflow

Throws an error with helpful message if the stage ID is invalid.

Type Parameters​

W​

W extends Workflow<any, any, any>

Parameters​

workflow​

W

stageId​

string

Returns​

asserts stageId is WorkflowStageId<W>

Example​

assertValidStageId(certificateWorkflow, stageId);
// Now TypeScript knows stageId is a valid stage ID