The Use of Undefined with exactOptionalPropertyTypes
Curious what your thoughts are on
Historically, I preferred
With
I'm not a huge fan of
For simplicity, I'm leaning towards making everything
How do you deal with nil-values?
undefined, given exactOptionalPropertyTypes. Historically, I preferred
undefined over null as the default "nil" value, and used null to signal explicitly "deleting" value, as opposed its absence. Only annoyance there is databases that cast undefined to null, so I have to write at least one conversion schema for the database read model.With
exactOptionalPropertyTypes though, I find that I'm writing even more schema conversions; some tooling spits out explicit undefineds, but over the wire, JSON gets rid of undefined, so values become optional.I'm not a huge fan of
Option for record-fields, makes models too complicated, I prefer using Option for the entire entity.For simplicity, I'm leaning towards making everything
null. I guess I could also do {key?: T | undefined}, and overload it. How do you deal with nil-values?
