Error Accessing `value` in `Option.orElse`

Why does accessing the same value cause an error in Option.orElse?

  if (Option.isNone(account.studentProfile)) {
    // handle None
    return ''
  }

  // this is ok
  const foo = account.studentProfile.value.dateOfBirth
  
  // this errors with: 
  //   Property 'value' does not exist on type 'Option<StudentProfile>'
  //     Property 'value' does not exist on type 'None<StudentProfile>'
  const bar = Option.orElse(() => account.studentProfile.value.dateOfBirth)
Was this page helpful?