title: How to write Yup schema in typescript in Nextjs
body: <p>Actually getting error when defining yup schema:</p>
  <p>Error: Cannot read properties of undefined (reading 'object')</p>
  <pre><code>import Yup, { object } from 'yup'
  import { useFormik } from 'formik'
  
  interface Account {
    username: string;
    email: string;
    password: string;
  }
  
  const loginSchema: Yup.SchemaOf&lt;Account&gt; = Yup.object().shape({
      email: Yup.string().email().required(),
      username: Yup.string().min(3).max(25).required().matches(/^[a-z0-9]+$/i, &quot;Username should contain alphabets and numbers only&quot;),
      password: Yup.string().required().min(4).matches(/^[a-z0-9]+$/i, &quot;Password should contain alphabets and numbers only&quot;)
    })
  </code></pre>
  <p>Actually i am new to yup and typescript, so pls tell me the actual way of defining yup in ts</p>