API reference@evolu/commonSchedule › whileScheduleInput

function whileScheduleInput<Input>(
  predicate: Predicate<Input>,
): <Output>(schedule: Schedule<Output, Input>) => Schedule<Output, Input>;

Defined in: packages/common/src/Schedule.ts:816

Continues while the input satisfies a predicate.

Stops (returns Err(Done<void>)) when Predicate returns false. Useful for input-aware retry strategies, e.g., only retry certain error types.

Example

interface MyError extends Typed<"Transient" | "Fatal"> {}

// Only retry transient errors
const retryTransient = whileScheduleInput(
  (error: MyError) => error.type === "Transient",
)(exponential("100ms"));