Skip to content
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

Curry and Pipe/Compose incompatibility #206

Closed
millsp opened this issue Feb 28, 2021 · 2 comments
Closed

Curry and Pipe/Compose incompatibility #206

millsp opened this issue Feb 28, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@millsp
Copy link
Owner

millsp commented Feb 28, 2021

I took these straight from the examples and the curried function inside compose is throwing an error.
The curried function has the correct type.
The composed function works without the curried one.

declare const compose: Function.Compose
declare function curry<Fn extends Function.Function>(fn: Fn): Function.Curry<Fn>

const a = curry((a1: number, d2:  number) => `${a1 + d2}`)
const c = (c1: string[]) => [c1]
const b = (b1: string) => [b1]

compose(c, b, a)(23,42)

You can try it in the ts-toolbelt codesandbox:
https://codesandbox.io/s/ts-toolbelt-x4jly?file=/src/index.ts

The error:

const a: Function.Curry<(a1: number, d2: number) => string>

Argument of type 'Curry<(a1: number, d2: number) => string>' is not assignable to parameter of type 
'Function<[a1?: number | x, d2?: number | x], string>'.
  Type 'Curry<(a1: number, d2: number) => string>' is not assignable to type 'string'.ts(2345)

Originally posted by @sugoidesune in #205

@millsp millsp added the bug Something isn't working label Feb 28, 2021
@millsp
Copy link
Owner Author

millsp commented Feb 28, 2021

@sugoidesune I'm looking into this

@millsp millsp changed the title I took these straight from the examples and the curried function inside compose is throwing an error. Curry and Pipe/Compose incompatibility Feb 28, 2021
@millsp
Copy link
Owner Author

millsp commented Feb 28, 2021

The fix will be out in a few minutes

@millsp millsp closed this as completed Feb 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant