Open assertnotnull opened 1 year ago
It seems the example should change like this:
pipe(
// ⬇️ const obj: User = { name: 'Joe', age: 20 }
R.fromNullable(obj, String('cannot be nullable')),
R.flatMap((obj) => {
return G.isNotNullable(obj.name) ? R.Ok(obj) : R.Error(String('missing name'))
}),
R.map((obj) => `${obj.name} is ${obj.age} year old!`)
) // → Ok('Joe is 20 year old!')
Those literal strings are regarded as the type of itself instead of a string type.
seems this issue is resolved in the ts-beltv4.
Using version 3.13.1
There's a type mismatch between the Result functions