Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

yup typescript

// npm i yup
// yup is already written in typescript

import * as yup from 'yup';

let schema = yup.object().shape({
  name: yup.string().required(),
  age: yup.number().required().positive().integer(),
  email: yup.string().email(),
  website: yup.string().url(),
  createdOn: yup.date().default(function () {
    return new Date();
  }),
});
 
PREVIOUS NEXT
Tagged: #yup #typescript
ADD COMMENT
Topic
Name
6+6 =