selfrefactor / rambdax

Extended version of Rambda
https://selfrefactor.github.io/rambdax
MIT License
221 stars 26 forks source link

Using R.prop with array utility methods returns unknown[] after version 9 #93

Closed mauriciosoares closed 9 months ago

mauriciosoares commented 1 year ago

I haven't tested this with a lot of different scenarios, but after upgrading rambdax to version 9 I noticed that I got a lot of types errors, after digging a bit I found that these are related to use R.prop along with array utils like R.sortBy and R.map, whenever these are used in combination the types returned by these array utils are almost always unknown[].

Here's an example of using rambdax on version 9.x

https://stackblitz.com/edit/typescript-aiuxp1?file=index.ts

And here's another using version 8.x

https://stackblitz.com/edit/typescript-h8izne?file=index.ts

You'll notice that on version 8, using both R.prop or passing a function as a callback returns the correct type, as opposed to version 9 that only works when using a function as a callback.

mauriciosoares commented 1 year ago

Btw, if I use R.prop directly without an array util it does return the correct type:

image

selfrefactor commented 1 year ago

Thanks for filling this issue. I will look into it.

selfrefactor commented 1 year ago

reason for the change is that I aligned several definitions with @types/ramda. I will check if we should revert back.

selfrefactor commented 1 year ago

Fix is done, It will be released with Rambda 8.3.0 and Rambdax 10.1.0

selfrefactor commented 9 months ago

Fixed with latest release