Map always returns a Promise not a value/object
terracotta-ko opened this issue · comments
Kobe Ko commented
Jim Reeves commented
Map is a transformer function so you can map from Promise<A>
to Promise<B>
but it's still going to be a Promise of some type afterwards.
In the example you show, I'd return Promise<EmailLoginResultDomain>
from the function and then at the calling site add the .done
closure to handle what you want to do with the EmailLoginResultDomain and a .catch
to handle the errors from the Promise chain.
Not sure on the logic you are looking to produce but the unused default Failure
seems like a candidate for a .recover
on the chain