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
This lib has improved a lot! and keep me from abandoning Ramda so Thanks to all 👏 💛
I don't get much how to type pathOr:
ttypeObj={selected: boolean}|undefinedconstobj: Obj=undefinedconstobj1: {}={}constobj2: Obj={selected: true}constselected: boolean=pathOr(true,['selected'],obj||{});// => Argument of type 'undefined' is not assignable to parameter of type '{}'.constselected1: boolean=pathOr(true,['selected'],obj1);// => this is unknown not booleanconstselected2: boolean=pathOr(true,['selected'],obj2);// => this is unknown not booleanconstselected3: boolean=pathOr<boolean>(true,['selected'],obj2);// => Argument of type 'string[]' is not assignable to parameter of type 'Placeholder'.constselected4: boolean=pathOr<boolean,boolean>(true,['selected'],obj2);// => this actually outputs boolean// ^ this works?(the second boolean, doesn't make much sense to me)constselected5: boolean=pathOr(true)(['selected'])(obj2);// => this is unknown not booleanconstselected6: boolean=pathOr<boolean>(true)(['selected'])(obj2);// => this is unknown not booleanconstselected7: boolean=pathOr<boolean,any>(true)(['selected'])(obj2);// => Expected 3 arguments, but got 1.constselected8: boolean=pathOr<boolean,boolean>(true)(['selected'])(obj2);// => Expected 3 arguments, but got 1.constselected9: boolean=pathOr<boolean,boolean,Obj>(true,['selected'],obj2);// => Expected 2 type arguments, but got 3.constselected10: boolean=pathOr<boolean,Obj>(true,['selected'],obj2);// => Type 'pathOr_111<boolean, Obj>' is not assignable to type 'boolean'.
for selected is there a better alternative than obj || {} I see that the type is a hardcoded {} but undefined works ok in ramda
It returns the same type as the defaults or the supposed type. I know this is not as simple to make, it's just a how I would expect it to behave when actually working with pathOr
So my question actually is: What's the best way to type/use pathOr ?
The text was updated successfully, but these errors were encountered:
This lib has improved a lot! and keep me from abandoning Ramda so Thanks to all 👏 💛
I don't get much how to type pathOr:
selected
is there a better alternative thanobj || {}
I see that the type is a hardcoded{}
butundefined
works ok in ramdaOversimplifying a lot, I would expect it to behave is something more like:
It returns the same type as the defaults or the supposed type. I know this is not as simple to make, it's just a how I would expect it to behave when actually working with
pathOr
So my question actually is: What's the best way to type/use
pathOr
?The text was updated successfully, but these errors were encountered: