Troubleshooting 'Either' Function Error in TypeScript Code

Hello everybody. What's wrong with this code?

function eitherFromRandom(random: number): Either.Either<'fail', number> {
  return random > 0.5 ? Either.right(random) : Either.left('fail')
}


Here's the error I'm getting:

    return random > 0.5 ? Either.right(random) : Either.left('fail')
    ~~~~~~
Was this page helpful?