Objects, Records, and Field Updates

Read Objects, Records, and Field Updates as a JavaScript and TypeScript habit shift, with links to the Musi Book definition.

TypeScript structural objects make shape feel lightweight. Musi keeps that benefit, but record shape does not also imply methods, prototype behavior, or package identity.

typescript
type Pet = { name: string; age: number };

const dog: Pet = { name: "Miso", age: 4 };

Reading Objects, Records, and Field Updates from JavaScript/TypeScript

On the Musi side, Musi records and data variants describe stored shape. Behavior belongs in functions or classes/instances, not inside an object by default. Read the shared example through JavaScript/TypeScript eyes: keep the useful instinct, then let Musi name shape, behavior, absence, and outside work in separate places.

False friend

Do not read class as object shape. If the page is about a pet, invoice, room, or vehicle, start with fields or variants. For a TypeScript reader, the trap is assuming runtime object shape and compile-time behavior contract are the same thing; Musi class is not a JS constructor or TS class; it is a behavior contract implemented separately from record/data shape.

When this pays off

Use records when names like owner, age, amount, or route are the point of the value. The JavaScript/TypeScript instinct still helps here: Keep the TypeScript habit of reading the shape before reading implementation details.

Keep close