类型'LodashReplace1x5'不可分配给类型'string'。

问题描述 投票:0回答:1

我有一个奇怪的问题,使用lodassfp在typescript.它的工作,但它显示错误.我不能找到了为什么会发生这种情况。

这里是错误。

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

typescript vuejs2 type-conversion lodash
1个回答
0
投票

我以为它会检测类型,但似乎我们必须明确地告诉类型,你可以在下面的图片中看到。

enter image description here

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.