Wrap your of results (or promises of results) to create elegant type safe code
Examples
Archaic error handling
constresult1=someOperation()if(!result.ok){constresult2=someOperation2(result.error)if(!result2.ok){// Do more things}}else{constresult3=someOperation3(result.value)if(!result.ok){// Some stuff}// More of that stuff}
TS-Wrap error handling
constresult=wrap(someOperation()).ifOkthen(asyncokValue=>{// Some stuff here}).ifErrThen(asyncerrValue=>{// ErrorHandling stuff}).ifOkthen(asyncokValue=>{// More stuff here})