export function UpdateAssessmentInputSchema(): yup.ObjectSchema<UpdateAssessmentInput> {
return yup.object({
answers: yup.array(yup.lazy(() => QuestionAnswerInputSchema().nonNullable())).defined(),
domainIndex: yup.number().defined().nonNullable(),
encodedId: yup.string().defined().nonNullable(),
groupIndex: yup.number().defined().nonNullable(),
previous: yup.boolean().defined().nonNullable(),
save: yup.boolean().defined().nonNullable()
})
}
export type UpdateAssessmentInput = {
answers: Array<QuestionAnswerInput>;
domainIndex: Scalars['Int'];
encodedId: Scalars['String'];
groupIndex: Scalars['Int'];
previous: Scalars['Boolean'];
save: Scalars['Boolean'];
};
export function QuestionAnswerInputSchema(): yup.ObjectSchema<QuestionAnswerInput> {
return yup.object({
answer: yup.string().defined().nullable().optional(),
index: yup.number().defined().nonNullable(),
multichoiceAnswers: yup.array(yup.string().defined().nonNullable()).defined()
})
}
Error TS2322 (TS) Type 'ObjectSchema<{ answers: { answer?: string; index?: number; multichoiceAnswers?: string[]; }[]; domainIndex: number; encodedId: string; groupIndex: number; previous: boolean; save: boolean; }, AnyObject, { ...; }, "">' is not assignable to type 'ObjectSchema<UpdateAssessmentInput, AnyObject, any, "">'.
The types of 'default(...).fields.answers' are incompatible between these types.
Type 'Reference<unknown> | ISchema<{ answer?: string; index?: number; multichoiceAnswers?: string[]; }[], AnyObject, any, any>' is not assignable to type 'Reference<unknown> | ISchema<QuestionAnswerInput[], AnyObject, any, any>'.
Type 'ISchema<{ answer?: string; index?: number; multichoiceAnswers?: string[]; }[], AnyObject, any, any>' is not assignable to type 'Reference<unknown> | ISchema<QuestionAnswerInput[], AnyObject, any, any>'.
Type 'ISchema<{ answer?: string; index?: number; multichoiceAnswers?: string[]; }[], AnyObject, any, any>' is not assignable to type 'ISchema<QuestionAnswerInput[], AnyObject, any, any>'.
Type '{ answer?: string; index?: number; multichoiceAnswers?: string[]; }[]' is not assignable to type 'QuestionAnswerInput[]'.
Type '{ answer?: string; index?: number; multichoiceAnswers?: string[]; }' is not assignable to type 'QuestionAnswerInput'.
Property 'index' is optional in type '{ answer?: string; index?: number; multichoiceAnswers?: string[]; }' but required in type 'QuestionAnswerInput'.
For some reasons it seems like the system believe all properties of QuestionAnswerInputSchema should be nullable but in the end gets some required property and fail.
It seems like their is some issues with array and nullable types
Results in this error:
For some reasons it seems like the system believe all properties of QuestionAnswerInputSchema should be nullable but in the end gets some required property and fail.