Full Stack Developer writing about functional programming, AI, and blockchain.
Markdown supported · ⌘↵ to post
The problem with this code:
sequenceS(E.either)({ email: validateEmail(email), password: validatePassword(password), })
Is if validateEmail and validatePassword has different left types it wont compile.
Is there a way around this?
David Novák
So far I was able to get around this error by manually specifying error types:
sequenceS(E.either as E.as apply.Apply2C< 'Either', ValidateEmailError | ValidatePasswordError)({ email: validateEmail(email), password: validatePassword(password), })
But it still is not pretty.