0Pricing
TypeScript Academy · Lesson

Typed pipe and flow Utilities

Build left-to-right pipelines with accurate inference.

From compose to pipe

pipe threads a value through functions left to right, the reading order most people prefer. pipe(x, f, g) means g(f(x)).

A Two-Step pipe

The simplest pipe takes a value and one function, returning the result. Reading top to bottom matches execution order.

const pipe2 = <A, B>(a: A, f: (a: A) => B): B => f(a);
console.log(pipe2(5, n => n + 1)); // 6

All lessons in this course

  1. Pure Functions and Immutability
  2. Currying and Partial Application
  3. Function Composition with Types
  4. Typed pipe and flow Utilities
← Back to TypeScript Academy