ramda / types

MIT License
27 stars 22 forks source link

`curry` no longer works with `map` #111

Open AndrewSouthpaw opened 7 months ago

AndrewSouthpaw commented 7 months ago

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 commented 7 months ago

@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 commented 7 months ago

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