Yup: extend another schema
4 October 2022 (Updated 4 October 2022)
const baseSchema = Yup.object().shape({
id: string().isRequired(),
name: string().isRequired()
})
// We extend the baseSchema
const extendedSchema = baseSchema.shape({
id: number().isRequired(),
age: number().isRequired()
})
Tagged:
JavaScript tooling