tslint

2020-06-29  本文已影响0人  penelope_2bad
  1. 错误: ts2345
    1.现象: 类型“number[]”的参数不能赋给类型“SetStateAction<never[]>”的参数。
    不能将类型“number[]”分配给类型“never[]”。
    不能将类型“number”分配给类型“never”。ts(2345)
    解决: 1. [] as number[] 这种不是最好的

  2. 现象:类型“{}”的参数不能赋给类型“CustomerBenefitAlgoItem | (() => CustomerBenefitAlgoItem)”的参数。
    不能将类型“{}”分配给类型“() => CustomerBenefitAlgoItem”。
    类型“{}”提供的内容与签名“(): CustomerBenefitAlgoItem”不匹配。ts(2345)

解决:

  // 证明非空
  const isValidEmpty = (param: object): param is CustomerBenefitAlgoItem => {
    if (Object.keys(param).length) {
      return true;
    }
    return false;
  };

[modelData?.result]
  1. 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 } = {};
上一篇 下一篇

猜你喜欢

热点阅读