ramda/types

Breaking change introduced

person1123 opened this issue · 6 comments

Hi - looks like this commit broke these types: 3f8e31d

[!] (plugin typescript) RollupError: @rollup/plugin-typescript TS1139: Type parameter declaration expected.
../../../../node_modules/@types/ramda/node_modules/types-ramda/es/index.d.ts (4453:22)
4453 export function pick<const Names extends readonly [PropertyKey, ...PropertyKey[]]>(names: Names): <U extends Record<ElementOf<Names>, any>>(obj: U) => string extends keyof U ? Record<string, U[keyof U]> : Pick<U, ElementOf<Names>>;

This error is because you are on typescript < 5

@types/ramda, which is backed by types-ramda is labeled that min support is typescript 5.0

Specifically, the const Type Parameter syntax is being used here

Fixable by adding

"resolutions": {
    "types-ramda": "0.29.4",
}

to package.json

@y-a-v-a if you do need to not consume the latest, that is a valid work-around for yarn. The npm equivalent is overrides

"overrides": {
    "types-ramda": "0.29.4"
}

Hello ! I have the same problem, my linter shows me error from this library, how can I disabled linter not to check this types ?

This MR should fix ts4 incompatibilities: #80

This MR should fix ts4 incompatibilities: #80

We still have issue on "typescript": "4.9.5".

Looks like typesVersions should solve this problem (I saw it in your PR, but it didn't get into the result branch):

  "types": "es/index.d.ts",
  "typesVersions": {
    "<5.0": { "*": ["ts4/es/index.d.ts"] },
    "*": { "*": ["es/index.d.ts"] }
  },

because now types still point to ts5 source types.

By now we use overrides method, but we live in an monorepo and only one package uses ramda (and in npm monorepo overrides only work in a root package - so its not best solution)