1. Introduction

ucm-ts keeps your TypeScript in a codebase instead of a folder of files. You write code in ordinary .ts files, as always; when it typechecks, you add it, and each function, type and constant is stored by a hash of its code. From then on, names are just labels on those hashes.

That one change has a lot of consequences, and they're the reason to use it:

It's Unison's codebase model, brought to plain TypeScript: no new language, no new syntax, and the code runs on Node as it is.

1.1 What it looks like

// scratch.ts
/** Square a number. */
export const square = (x: number): number => x * x;

square(12);
$ ucm check
scratch.ts
  + new       square : (x: number) => number

    7 │ square(12)
      ⧩ 144

$ ucm add
  + new       square : (x: number) => number

square(12) on its own line is a watch expression: ucm runs it and shows its value, like a REPL inside your file. square itself is now in the codebase, and any other file can use it with import { square } from "#codebase".

1.2 Where next

built from 5890e54f