Briefle words · Code & architecture
Domain type
A type named after a real concept in the business, which keeps related data and rules together.
Say it to an AI
TypeScript money.ts module in src/cart: a cohesive module built around a Money domain type ({ cents, currency }) with formatMoney, addMoney and applyDiscount. Keep unrelated helpers like slugify or sleep out of it; no generic utils file.
How an expert would brief the stronger version of “Price helpers”.
See it
Try it as a puzzle →Where an online store's shared helpers for cart prices live in the codebase.
Why: A's 'Money = { cents, currency }' makes 'addMoney' check currencies; B's 'addPrices(a: number, b: number)' would happily add dollars to euros.
Related words
Room 3 · Functions & structure
Learn “Domain type” in a five-minute lesson