Обзор
functionComposition

succeed

Creates a behavior that always succeeds with the same value.

Signature

tsSignature
export function succeed<O>(value: O): Behavior<unknown, O, never>;

Imports

tsImport
import { succeed } from "@/lib/flow/succeed";
import { succeed } from "@/lib/flow";

Type Parameters

O

Output value type.

Parameters

value
O

Value returned for every execution.

Returns

A behavior that ignores input and returns `Ok`.

Return type
Behavior<unknown, O, never>

Details

Use `succeed` for constant branches, tests, and pipeline defaults.

Examples

tsExample
const cached = succeed({ source: "cache" });
Behavior

Executable Flow workflow unit.

type

Source

tsflow/succeed.ts:18-20
export function succeed<O>(value: O): Behavior<unknown, O, never> {
return task<unknown, O, never>((_input, context) => context.ok(value));
}