v.string().isOptional property not working
Hello,
I saw available the isOptional property in the v.string()
But I have an error after I use it in the property name.
Any suggestion?
3 Replies
can you describe what you're trying to do, or give the full code? It's possible you want
v.optional(v.string())
Yes, v.optional(v.string()) works ok. I just was curios I saw that property there.
Thanks
isOptional
allows you to introspect a validator, so if you're given a validator you can determine whether it was constructed with v.optional
. It's not useful for constructing new validators