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'm trying to figure out a way to define some sort of runtime value validation but it should be a complementary API. Right now you can write some sort of custom validation for cases where you need it:
classUserextendsData{name: string='Anon';age: number=0;staticfrom(values){letname: string=values.name??'Anon'if(isNaN(values.age)){thrownewError('age is missing')}letage: number=values.age;returnUser.create({ name, age })}}
Maybe we could implement a validate method that does nothing on the parent class, that you can override on the child class if you need validation and throw
Hi everyone, I'm trying to figure out how to implement a method to add custom validation.
Some idea?
Thanks a lot!
The text was updated successfully, but these errors were encountered: