DEV Community

Discussion on: Nested Conditional Operators

 
qm3ster profile image
Mihail Malo • Edited

Yeah, Result<Err, Val> is an awesome datatype, but it's not the norm in JS, unfortunately.
How great would Promise<Err, Val> = Future<Result<Err, Val>> be :)

Instead, they integrated with exceptions, which makes throwing inside an async function great, but makes awaiting a fallible promise pretty ugly.

Thread Thread
 
joelnet profile image
JavaScript Joel

That's the difficulty is going opposite of the norm. It really works out well when your entire application is designed that way, but can be odd when you inject it into an existing application.

Consistency across the application is more important. So I will do these things with a new app, but code in the same style as existing apps just for consistency.

Thread Thread
 
qm3ster profile image
Mihail Malo

Look what I found.

Thread Thread
 
joelnet profile image
JavaScript Joel

This guy knows what up ;)