re: Type-Safe Error Handling In TypeScript VIEW POST

VIEW PARENT COMMENT VIEW FULL DISCUSSION
 

Would be great if typescript allows pattern matching, then you’ll do

with(result){
   Err(e) => console.log(“error!”);
   Ok(value) => console.log(value);
}
 

Actually you can do something similar:

blog.logrocket.com/pattern-matchin...

It’s not as pretty as real pattern matching but it fits to this use car.

code of conduct - report abuse