Closed ridhlab closed 8 months ago
Describe the bug
I have schema
const schema = yup.object().shape({ name: yup.string().required(getRequiredMessage("Name")), dataInput: yup .array() .of( yup.object().shape({ variableInputId: yup .number() .required(getRequiredMessage("Variable Input")), value: yup.number().required(getRequiredMessage("Value")), }) ) .required(), });
I expect the infers type of this schema is
{ name: string, dataInput: { variableInputId: number, value: number }[] }
But what I get is
{ name: string, dataInput: { variableInputId?: number, value?: number }[] }
I don't know why property inside object of array become optional instead of required. Is something wrong ?
yup version : ^1.3.3 typescript version : ^5.2.2
Experiencing the same issue with typescript 5.1.3 and yup 1.3.3.
I have same issue with yup 1.3.3
This works for me:
Please provide a runnable repro using the template
Describe the bug
I have schema
I expect the infers type of this schema is
But what I get is
I don't know why property inside object of array become optional instead of required. Is something wrong ?
yup version : ^1.3.3 typescript version : ^5.2.2