Apply Illegal States Unrepresentable

Use when a type's fields can be combined into states that shouldn't exist — optional fields that are only sometimes valid together, booleans that must stay in sync, a string field that's really one of a few fixed cases — redesign the type (discriminated unions, parsed domain types, state machines) so the invalid combination cannot be constructed at all, rather than validating against it at runtime.

jeffreytse Updated
grimoire

File contents

jeffreytse/grimoire-core commit 9d266d2adb

Frequently asked questions

npx get-skill add jeffreytse/apply-illegal-states-unrepresentable