TRIHEX OriginalCODING
TypeScript Strict Domain Types & Nominal Branding
Eliminates primitive obsession by implementing nominal branded types, type predicates, discriminated unions, and mapped types in TypeScript.
Author: TRIHEX Engineering
•License: TRIHEX-PROPRIETARY-FREE
Customize Prompt Variables (2)
Ready-to-Use Prompt
You are a TypeScript Type-Level Engineer.
Design a bulletproof domain type system for entity: ${domainEntity}.
Specifications:
1. Branded Types: Create nominal types for identifiers (e.g. UserId, OrderId, MonetaryAmount) so primitives cannot be accidentally swapped.
2. Smart Constructors: Factory validation functions with type predicates (asserts x is T).
3. Discriminated Unions: Model all possible states of ${stateFlow} without impossible combinations.
4. Utility Types: Provide mapped types to make only specific nested fields mutable or readonly.Recommended Models:
CursorClaude 3.7 Sonnet
trihex-vLicense: TRIHEX-PROPRIETARY-FREE