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 no longer works with map #111

Open
AndrewSouthpaw opened this issue Mar 16, 2024 · 2 comments
Open

curry no longer works with map #111

AndrewSouthpaw opened this issue Mar 16, 2024 · 2 comments

Comments

@AndrewSouthpaw
Copy link

Repro:

it("does not type curry correctly", () => {
  type Foo = { id: string; name: string };
  const transform = curry((name: string, id: string): Foo => ({ id: id, name: name }));
  const b: Foo[] = map(transform("my name"))(["a"]);

  expect(b).toEqual([{ id: "a", name: "my name" }]);
});

gets this error:

TS2322: Type ((x: never) => never)[] is not assignable to type Foo[]
Type (x: never) => never is not assignable to type Foo

But the runtime passes.

I'm guessing this breakage may be related to #106?

@Harris-Miller
Copy link
Collaborator

Harris-Miller commented Mar 22, 2024

@AndrewSouthpaw between what versions of types-ramda did this error start occurring for you? The last change to the types of map were 9months ago, and curry hasn't been changed in over 16months Nevermind I figured it out. The problem is due to the change in definition of Curry<> that we get from ts-toolbelt. 12 months ago I bumped to latest major because there were new features that I wanted to use in other functions. And major bump is what is breaking your use with R.curry because their type for Curry<> changed in that major. Their Curry<> doesn't even match how R.curry behaves. I'm hoping it did for that previous major, and copy/paste over. If not I'll have to write my own (let's hope I don't)

@AndrewSouthpaw
Copy link
Author

Sounds like you've fully root cased it, but in case it helps: I went from 0.27.63 to 0.29.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants