diff --git a/.changeset/afraid-phones-love.md b/.changeset/afraid-phones-love.md new file mode 100644 index 00000000000..9a2ac388872 --- /dev/null +++ b/.changeset/afraid-phones-love.md @@ -0,0 +1,5 @@ +--- +"@effect/workflow": patch +--- + +Add Workflow type utils diff --git a/packages/workflow/src/Workflow.ts b/packages/workflow/src/Workflow.ts index b57cca09dd7..ea21fdcaa2a 100644 --- a/packages/workflow/src/Workflow.ts +++ b/packages/workflow/src/Workflow.ts @@ -25,6 +25,41 @@ import type { WorkflowEngine, WorkflowInstance } from "./WorkflowEngine.js" */ export const TypeId: unique symbol = Symbol.for("@effect/workflow/Workflow") +/** + * @since 1.0.0 + */ +export declare namespace Workflow { + /** + * Extracts the type of the Payload of a `Workflow`. + * + * @since 1.0.0 + * @category Type-level Utils + */ + export type Payload> = W extends Workflow + ? Payload["Type"] + : never + + /** + * Extracts the type of the Success of a `Workflow`. + * + * @since 1.0.0 + * @category Type-level Utils + */ + export type Success> = W extends Workflow + ? Success["Type"] + : never + + /** + * Extracts the type of the Error of a `Workflow`. + * + * @since 1.0.0 + * @category Type-level Utils + */ + export type Error> = W extends Workflow + ? Error["Type"] + : never +} + /** * @since 1.0.0 * @category Symbols