Overview

Map TypeScript 5.9 / modern JavaScript habits to the Musi Book without repeating every construct example.

TypeScript sits on JavaScript objects, modules, promises, undefined, structural typing, and a huge package culture. Musi keeps the useful instinct of making shapes visible, but is less willing to let missing values, promises, or object methods carry hidden meaning. Data, records, classes, instances, and effects each have separate jobs.

Use this guide as a translation journal for JavaScript/TypeScript code. Start with the familiar habit, then ask which Musi construct owns the same promise. A page is successful when it tells you which old instinct to keep and which old shortcut to drop.

Start from the habit that hurts

Habits that still help

  • Keep the TypeScript habit of reading the shape before reading implementation details.
  • Drop the idea that any object with the right fields also explains behavior, absence, or outside work.
  • Keep examples tied to ordinary work: receipts, routes, files, animals, people, rooms, and services.

First false friend

Musi class is not a JS constructor or TS class; it is a behavior contract implemented separately from record/data shape. If you need a person, car, invoice, or package, start with records or data. If you need any type that can compare, show, encode, or step, use a class with instances.

When to switch to the Musi Book

Stay in this guide while a JavaScript/TypeScript habit is getting in the way. Switch to Values and let, Records, Patterns, Generics, Classes, and Effects when you need the source-of-truth rule.