API reference › @evolu/common › Schedule › passthrough
Call Signature
function passthrough<A>(): Schedule<A, A>;
Defined in: packages/common/src/Schedule.ts:1459
Creates a schedule that outputs its input, or wraps an existing schedule to output input instead of the original output.
When called with no arguments, creates a schedule that outputs its input directly (the "identity" schedule). When called with a schedule, wraps it to preserve timing behavior but replace output with input.
Passing through input
import {
assertEqual,
assertOk,
assertType,
Data,
exponential,
passthrough,
testCreateDeps,
} from "@evolu/common";
interface MyError {
readonly message: string;
}
// Constructor form emits input immediately; combinator form keeps timing.
const identity = passthrough<MyError>();
const withInput = passthrough(exponential("100ms"));
const error = { message: "Unavailable" };
const deps = testCreateDeps();
const identityResult = identity(deps)(error);
assertOk(identityResult);
assertType(Data, identityResult.value);
assertEqual(identityResult.value, [error, 0]);
const inputResult = withInput(deps)(error);
assertOk(inputResult);
assertType(Data, inputResult.value);
const inputValue: Data = inputResult.value;
assertEqual(inputValue, [error, 100]);
Call Signature
function passthrough<Output, Input>(
schedule: Schedule<Output, Input>,
): Schedule<Input, Input>;
Defined in: packages/common/src/Schedule.ts:1461