title: Yup.when: "`NaN` (cast from the value `NaN`)"
body: <p>I'm trying to implement a quite basic validation for a form field/select. Validation schema:</p>
  
  <pre><code>vehicleProvider: Yup.object() // This is an object which is null by default
      .required('formvalidation.required.message')
      .nullable(), 
  reserveVehicle: Yup.number().when('vehicleProvider', { // This is a number which is null by default
      is: provider =&gt; provider?.hasReserve,
      then: Yup.number()
          .required('formvalidation.required.message')
          .nullable(),
      otherwise: Yup.number().notRequired()
  }),
  </code></pre>
  
  <p>What I want to do: Only require/validate <code>reserveVehicle</code> if <code>provider.hasReserve</code> is <code>true</code>. Otherwise, don't require the number.
  I get this error:</p>
  
  <blockquote>
    <p>"reserveVehicle must be a <code>number</code> type, but the final value was: <code>NaN</code> (cast from the value <code>NaN</code>)."</p>
  </blockquote>
  
  <p>This makes sense (kind of) because, well <code>null</code> is Not a number. But as I'm trying to tell it that it shouldn't be required, in my opinion it shouldn't try to evaluate it.</p>
  
  <p>Did I miss any key concepts of <code>Yup</code>?</p>