4
const greet = R.replace('{name}', R.__, 'Hello, {name}!');
greet('Alice'); //=> 'Hello, Alice!'

The above code is copy from Ramda's documment, when a pate it in typescript environment, typescript complains:

Argument of type 'Placeholder' is not assignable to parameter of type 'string | ((match: string, ...args: readonly any[]) => string)'.   Type 'Placeholder' is not assignable to type '(match: string, ...args: readonly any[]) => string'.     Type 'Placeholder' provides no match for the signature '(match: string, ...args: readonly any[]): string'.

How to solve this complaint?

nolan
  • 439
  • 3
  • 13
  • That's interesting. But it sounds the current defined doesn't support placeholder though. You might have to skip this check for now until they support curry function accordingly – tmhao2005 Aug 01 '20 at 14:22
  • @ tmhao2005 Yes that is what i am thinking, thank you – nolan Aug 26 '20 at 04:21
  • 1
    If you're interested in curry function typing, here's a very good article taking about that. Seems like the author is also keen to merge his work to as official type: https://www.freecodecamp.org/news/typescript-curry-ramda-types-f747e99744ab/ – tmhao2005 Aug 26 '20 at 04:29
  • @tmhao2005 That's a nice article, thanks – nolan Aug 26 '20 at 11:55

0 Answers0