What does the ‘shape’ function do in yup?

You can also pass a shape to the object constructor as a convenience.
yupobject documentation

Basically passing the schema to shape is just the long-form of passing it to the object constructor. Shape does however offer the benefit of chaining and overloading definitions in later chained methods. See yup.shape documentation

Leave a Comment