Lodash cond function typescript

75 Views Asked by At

I have two functions and I want to call them the way it is done in Lodash. First function private a(a: string, b: string) { retrun false; }

Second function private b(a: string, b: number, c: boolean) { return c; }

I want to call it like const func1 = lodash.cond([ [this.a, () => {}], [this.b, () => {}], ]); const gfg = func1('1', '2');

And with this call i have 2 errors First

Overload 2 of 2, '(pairs: CondPairUnary<string, void>[]): (Target: string) => void', gave the following error. Type '(a: string, b: string) => {}' is not assignable to type '(val: string) => boolean'. Target signature provides too few arguments. Expected 2 or more, but got 1. Overload 2 of 2, '(pairs: CondPairUnary<string, void>[]): (Target: string) => void', gave the following error. Type '(a: string, b: number) => {}' is not assignable to type '(val: string) => boolean'. Target signature provides too few arguments. Expected 2 or more, but got 1.

Second

Expected 0 arguments, but got 2. const gfg = func1('1', '2');

0

There are 0 best solutions below