IF Commons GitHub

Core

Quality: 21 tests: 21 passed, 0 failed, 0 skipped, 7 of 8 requirements proved, 0 open issues, 0 open tickets. The tests and issues of the library

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);
  }
}

Titles, headings, exports, tables, columns and requirements. Esc closes.