'Curried function seems not typesafe with Typescript and ramda
I have a function:
function myFunction(n: number, s: string, n2: number): boolean {
throw ''
}
I partially call it using ramda 0.27.1:
const curriedStringNon = curry(myFunction)(123, 'string')
But then I missed some typesafety:
curriedStringNon(123) // <- this is allowed which is expected
curriedStringNon('string') // <- this errors as it should
curriedStringNon() // <- but why is this allowed?
I don't expect this to compile because myFunction cannot be called with only two args:
myFunction(123, 'string') // <- this also errors which is expected
Solution 1:[1]
As I said in the comments,
From Ramda's point of view, that's not an error. You just get back the function. This has been a point of contention even among the core team, but I'd argue that it's the most logical behavior.
and
I wrote an answer several months ago that has some bearing on this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Scott Sauyet |
