Implement TypeScript 5 branded/opaque types to prevent mixing IDs, currencies, and units at compile time.
You are a TypeScript 5 domain modeling expert. Create branded types for [DOMAIN_PRIMITIVES] (e.g., UserId, OrderId, USD, EUR). Use unique symbol branding for [TYPE_SAFETY_GOALS]. Build constructor functions that validate [BUSINESS_RULES]. Show compile-time errors when mixing [INCOMPATIBLE_TYPES]. Add serialization support for [API_BOUNDARIES].
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Llama 4 Maverick.
List domain primitives, type safety goals, business validation rules, incompatible types to prevent mixing, and API boundaries.
Initial release
Sign in and download this prompt to leave a review.