Overview
Documentation for @pencroff-lab/kore, a TypeScript core utilities library
providing value-based error handling: the immutable Err type and flow, a
tier of free functions over ResultTuple<T>.
Everything linked from this page ships inside the npm package. If you are
reading this from node_modules/@pencroff-lab/kore/docs/, you are reading the
documentation for the exact version you have installed — prefer it over the
website when the two disagree.
Start here
import { Err, ok, fail, pipe, onOk, onErr, defaultTo } from "@pencroff-lab/kore";
import { expectOk, expectErr } from "@pencroff-lab/kore/test";The package has two entry points: the root export carries the library, and
@pencroff-lab/kore/test carries the assertion helpers so they never reach
production bundles.
A ResultTuple<T> is readonly [T, null] | readonly [null, Err]. The error
slot is the only failure signal — no operation inspects a value’s runtime
shape. Every fallible callback returns a ResultTuple; maps and explicit value
adapters carry their callback returns as data.
API reference
Generated from the source comments; regenerated on every release.
- Overview — every exported symbol
- flow
— the primary API: free functions over
ResultTuple<T> - Err — immutable error type with wrapping, aggregation, codes, and JSON serialization
- test helpers
—
expectOk/expectErr, from the/testsubpath - Outcome — deprecated and frozen since v0.7.0
- Logger — structured, level-filtered logging
- dtStamp — compact, sortable date/time stamps
Guides
- Flow operation flows — creating results, exception boundaries, transformations, pipelines, combinators, terminal operations, serialization, input protection
- Error handling patterns
—
Errcomposition, propagation, and the nominal type guard - Migration from throwing
— step-by-step
conversion from
try/catchto result tuples - Logging guide — levels, transports, conventions
Examples
Every example page is generated from an executable test file, so the code runs in the library’s own test suite.
- All examples
- flow examples
- Err examples
- test helper examples
- Outcome examples
- Logger examples
- dtStamp examples
Contributor documentation
These describe how the library itself is written; they are not needed to use the package.
- Documentation guide — the documentation layer model and budget rules
- TSDoc formatting rules
For agents
Start with the core subset and safety rules .
llms.txt
at the package root is the machine-readable index of
this documentation set. It links only to files that ship in the package.