Closed Ridermansb closed 10 months ago
You can check the TS type for more details, it's a set of values that is used to resolve conditional schema. If you don't have issues using getDefault()
without the options then you probably don't need to worry about it
@jquense the reason for I'm asking is because I was wondering if there is any way to get the values from object and for the values that was not defined, pick the default one.
Something like this...
const mySchema = yup.object({ firstName: yup.string().default(''), lastName: yup.string().default('') });
const me = {
firstName: "Riderman"
}
const initialData = mySchema.getDefault({ value: me }) // BUT NOT WORKING
Since there is no documentation about value
and the Type definition is any
I still don't know what is this for.
I endup doing something this ...
const defaultData = mySchema.getDefault();
const initialData = {
...defaultData,
...me
}
I was trying to get the default value from schema and if the value is provided in the data get the data value instead...
Something like this..
But I couldn't find any documentation about this.