錯(cuò)誤: ts2345
1.現(xiàn)象: 類型“number[]”的參數(shù)不能賦給類型“SetStateAction<never[]>”的參數(shù)。
不能將類型“number[]”分配給類型“never[]”。
不能將類型“number”分配給類型“never”。ts(2345)
解決: 1. [] as number[] 這種不是最好的現(xiàn)象:類型“{}”的參數(shù)不能賦給類型“CustomerBenefitAlgoItem | (() => CustomerBenefitAlgoItem)”的參數(shù)。
不能將類型“{}”分配給類型“() => CustomerBenefitAlgoItem”。
類型“{}”提供的內(nèi)容與簽名“(): CustomerBenefitAlgoItem”不匹配。ts(2345)
解決:
// 證明非空
const isValidEmpty = (param: object): param is CustomerBenefitAlgoItem => {
if (Object.keys(param).length) {
return true;
}
return false;
};
[modelData?.result]
- Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. No index signature with a parameter of type 'string' was found on type '{}'.
解決:
const templateTypeConfig: { [propName: string]: any } = {};