title: Validation form with optional fields react-hook-forms
body: <p>I'm trying to handle a form composed by two parts, one fixed and the other one that gets displayed by a switch.</p>
  <p>To handle the forms I'm using <code>react-hook-form</code>.</p>
  <p>I defined a validation scheme in the file validation.ts inside the constants folder.
  About the optional part I defined a sub-object but it doesn't work and it gives a compile time error.
  Because of this I opted for the solution you'll find in the link at the bottom of the page</p>
  <p>Although I defined the optional input fields inside the validation file, they don't get recognized when I press the submit button.</p>
  <p>How can I fix this problem?</p>
  <p>At this <a href="https://snack.expo.io/@foobanizer137/validation-error" rel="nofollow noreferrer">link</a> you can find a working example of the problem.</p>