You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inconsistency between Cause.Fail instance and toJSON #4683
import{Cause}from"effect";constcause=Cause.fail("Error");console.log(cause);if(Cause.isFailType(cause)){// console.log(cause.failure); <-- does not type checkconsole.log(cause.error);}
The console.log(cause) prints the following
{ _id: 'Cause', _tag: 'Fail', failure: 'Error' }
Indicating that there should be a failure property on the cause object. But in reality there is none as can be seen in the if statement. There is a error property though.
What is the expected behavior?
I was expecting that what the console.log emitted should correspond to the structure of the cause object.
What do you see instead?
The console.log(cause) indicates that there is a failure property on the cause object, when there in fact is no such property.
Additional information
I believe this are due to the toJSON implementation for the Cause.Fail in effect/src/internal/cause.ts.
Activity