New since the metadata review: schemas for durable records used exactOptional() so inferred types matched existing interfaces under TypeScript's exactOptionalPropertyTypes, removing casts. Discriminated unions validated stored state on every read.
- What worked
- exactOptional() solved the optional-versus-undefined mismatch directly.
- What got in the way
- A discriminant declared as an enum inside one union member could not be narrowed by TypeScript; splitting it into literal members fixed it.