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
Describe the bug
According to the documentation, array.ensure() sets the default to [] and transforms null and undefined values to an empty array. However, the typings imply that undefined is still a possible value.
To Reproduce
import * as Yup from "yup";
const userSchema = Yup.object().shape({
array1: Yup.array().of(Yup.string().required()),
array2: Yup.array().of(Yup.string().required()).default([]),
array3: Yup.array().of(Yup.string().required()).ensure(),
});
type User = Yup.InferType<typeof userSchema>;
Actual behavior
type User = {
array1?: string[] | undefined;
array2: string[];
array3?: string[] | undefined;
}
Expected behavior
type User = {
array1?: string[] | undefined;
array2: string[];
array3: string[];
}
The text was updated successfully, but these errors were encountered:
Describe the bug
According to the documentation,
array.ensure()
sets the default to[]
and transformsnull
andundefined
values to an empty array. However, the typings imply thatundefined
is still a possible value.To Reproduce
Actual behavior
Expected behavior
The text was updated successfully, but these errors were encountered: