Core
Core, the foundation of Intellectual Frontiers Commons (its specification 0001-core): errors as values (Result), exhaustive matching (absurd), branded types (Brand), decoders from unknown to typed values, the pure text helpers, type-level tests, graphs of work and objects made for exactOptionalPropertyTypes. It imports nothing, names no host global and runs wherever ECMAScript does (Bun, Node, a browser, a Worker).
Entry points
Modules
Examples
import { absurd, err, ok, type Result } from "@intellectual-frontiers/core";
type Stage = { readonly kind: "intake" } | { readonly kind: "review" };
function next(s: Stage): Result<Stage, string> {
switch (s.kind) {
case "intake": return ok({ kind: "review" });
case "review": return err("review is the last stage");
default: return absurd(s);
}
}