YUP Walidacja TypeScript
// install yup
// npm install -S yup
// import yup
import * as yup from yup;
// prepare a schema
let schema = yup.object().shape({
name: yup.string().required(),
age: yup.number().required().positive().integer(),
email: yup.string().email()
});
// validate any object
schema
.isValid({
name: 'jimmy',
age: 24,
})
.then(function (valid) {
valid; // => true
});
Himanshu Jangid