Тип 'LodashReplace1x5' нельзя назначить типу 'string' - PullRequest
0 голосов
/ 02 мая 2020

У меня странная проблема с использованием lodass / fp в машинописи. это работает, но это показывает ошибку. Я не мог выяснить, почему это происходит.

вот ошибка:

TS2769: No overload matches this call.   Overload 1 of 3, '(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string', gave the following error.     Argument of type '(acc: string, curr: string) => fp.LodashReplace1x5' is not assignable to parameter of type '(previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string'.       Type 'LodashReplace1x5' is not assignable to type 'string'.   Overload 2 of 3, '(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string', gave the following error.     Argument of type '(acc: string, curr: string) => fp.LodashReplace1x5' is not assignable to parameter of type '(previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string'.       Type 'LodashReplace1x5' is not assignable to type 'string'.

в чем проблема? как мне это исправить?

enter image description here

1 Ответ

0 голосов
/ 02 мая 2020

Я думал, что он обнаружит тип, но, похоже, мы должны явно указать тип, как вы можете видеть на картинке ниже:

enter image description here

...