Loading page…
Loading page…
A lightweight, zero-dependency toolkit for building and composing reusable TypeScript type guards while preserving useful narrowing.
pnpm add is-kit
import { and, or, not, predicateToRefine, isString, isNumber } from 'is-kit';const isShort = predicateToRefine<string>((s) => s.length <= 3);const isShortString = and(isString, isShort); // isShortString: (value: unknown) => value is stringconst evaluations = ['ok', 'toolong', 123].map((value) => isShortString(value));// evaluations: [true, false, false]or(isString, isNumber)('x'); // truenot(isString)(42); // true
Author and compose predicates that refine types precisely.