You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think in general SuperStruct wants its user to start with the most restrictive validation, and then gradually loosen it with optional and nullable, etc... Adding required here might become quite confusing.
For example, if we require something that is optional, do we just negate it? What about for partial? To me, the below seems quite awkward.
The other consideration here is that if we do allow this, then we might end up with a huge callback problem. I've already run into it while trying to test my own implementation of this, but essentially under the hood this is going to make a struct which for each check, will make things optional, then make this required, then optional, then required... Unless we can go into the struct itself and have it simplify itself, I'm worried about the performance of this.
So I can't really see the reason for having this when we could just start in the first place with everything required and loosen it up with modifiers.
As we have support for Typescript's
Partial
, can we also have support forRequired
as well?The text was updated successfully, but these errors were encountered: