-
Notifications
You must be signed in to change notification settings - Fork 64
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
Composition and argument order: pipe ok, compose errors #92
Comments
So, I think there are two things going on here; an issue with
|
I just realized the definitions for regular/promise versions of pipe/compose are returning curried functions, while they shouldn't. I now fixed that. This hasn't actually fixed the root cause here. I'm inclined to think though that the actual cause here mirrors the problem in the issue above. Based on that, let's stick to that thread for the moment; we can reopen this if they turn out different after all. Your example is part of the test suite now, so we won't forget. Thanks again for bringing this up! |
I've done an odd find -- inference appears to depend on parameter order. Consider the following contrast: // can't infer cond paths, must annotate:
const x: <T>(v: T) => T = R.cond([
[R.F, R.F],
[R.T, R.identity]
]);
// argument order matters for some reason...
const y: (v: number) => number = R.pipe (R.inc, x); // ok
const z: (v: number) => number = R.compose(x, R.inc); // boom This is super weird. Apparently |
Closing as a TypeScript limitation, see microsoft/TypeScript#15680 (comment). Added to the readme to inform users. |
Actually, in new TS |
Okay, guess I'm gonna have to figure out where it did work then... weird. |
If I use compose or pipe with cond function, there is an compiling error.
at compose/pipe line.
The text was updated successfully, but these errors were encountered: