pipe
Composes transforms from left to right and returns one reusable transform.
// Internal helper types are omitted here for brevity.
function pipe<
const Transforms extends readonly [
Transform<never, unknown>,
...Transform<never, unknown>[],
],
>(...transforms: Transforms & ValidatePipeline<Transforms>): Piped<Transforms>;
const toUser = pipe(
rename({ user_id: "id" }),
defaults({ role: "viewer" }),
normalize({ balance: "number" }),
);
const user = toUser({ user_id: 1, balance: "9.50" });
The output of each stage becomes the input to the next stage. Runtime composition uses a synchronous reducer and does not catch transform errors.
The public signature uses variadic tuple inference. It has no fixed stage-count overload limit: each transform must accept the previous transform's output, and the returned function carries the final inferred output type. As with other recursive TypeScript types, exceptionally long pipelines remain subject to the compiler's instantiation-depth and performance limits.
See Failure behavior for incompatible stages and propagated runtime errors.