3 ms·
In this contrived example, the deletedDate alone is enough to create the required states (Deleted being when there is a deletedDate) without creating any invali
by alkonaut 11y ago
In this contrived example, the deletedDate alone is enough to create the required states (Deleted being when there is a deletedDate) without creating any invalid date (Deleted without deleted date or vice versa).
In general though, if there were 3 states (active, suspended, deleted) where some states required more data than others, I'd probably make a struct+enum to create the equivalent of the F# type. The user can expose the state while hiding the fact that it has a more complex internal field.