-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript applies wrong definition for pipe(map) composition. #411
Comments
The error is the same as yours. I will investigate further, I just wanted to share what happens if I use Ramda typings. For most of the typings I try to follow Ramda typings, but in this case you can see that Ramda typings inself doesn't work well with pipe. Those typings made me stop using compose and pipe with Typescript - currently they don't work well together. |
The main reason I've switched to Rambda was to use in-house developed types. As far as I know Ramda types are supplied by others than the main devs and they are quite inconsistent. I had many issues with those as you did. Thanks for looking into the problem 👍 |
I just checked your suggestion - to change order of lines. Typings tests didn't broke so I will go and release it with the next bump. I am keeping the issue open, as I have to assure that this change is moved to the other branch I am working on. In regards to Ramda typings - the developers who wrote them, definitely know Typescript more than me. The main reason for the quality is one still unresolved Typescript issue. which forces such style for methods such as R.compose/pipe |
I am relatively new to functional programming and typescript, so please check if what i am doing makes sense first.
If i write a simple pipe as following,
Typescript compiler as follows,
For some reason typescript compiler gets the map the definition at index.d.ts:393, which has the signature,
export function map<T, U, S>(mapFn: MapFunctionObject<T, U>): (x: Dictionary<T>) => Dictionary<U>;
, even if what i am trying to do is not including any Dictionaries.If I move this definition to line 395, then typescript compiler doesn't throw any errors.
The original file:
Updated version:
I am not sure what is the root cause, but my wild guess is something related to number of arguments functions take makes typescript compiler give them priority or it's just wrong.
I am also not exactly sure if this is a typescript-library problem or it's caused by how I am trying to use it.
The text was updated successfully, but these errors were encountered: