Getting Started
Install
Install dismatch with npm, pnpm, yarn, or bun.
npm install dismatchpnpm add dismatchyarn add dismatchbun add dismatchRequirements
- TypeScript 5.x —
dismatchleans on modern conditional and template literal types for handler inference. - ESM or CommonJS — both are exported. The package is
sideEffects: falseso any modern bundler will tree-shake unused functions. - Zero runtime dependencies.
Subpath imports
dismatch ships three import paths so async and remote-data code only land in
your bundle when you ask for them:
import { match, createUnion, createPipeHandlers } from "dismatch";
import { matchAsync, foldAsync } from "dismatch/async";
import { RemoteData } from "dismatch/remote-data";A project that only uses match and is ships well under 1 kB.
Next step
Continue to the Quick Start for a tour of the main APIs in five short steps.