Yup: extend another schema
4 October 2022 (Updated 26 October 2023)
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:
Yup
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment