绑定元素“seriesName”隐式具有“any”类型

const book = {
  ...
  actions: {
    mergeBook({ state, commit }, data: any) {
      return axios.patch(`/books/merge`, data)
        .then((res: any) => {
          return res;
        });
    }
  },
};

在typescript的编译过程中,函数的参数被提示 {变量名} implicitly has an ‘any’ type,但是笔者也不知道应该指明他为什么类型的参数。

mergeBook({ state, commit }: { state: any, commit: any }, data: any) {
  ...
}
第二种解决方法简单粗暴,直接关闭这个校验规则:tsconfig.json 中 添加"noImplicitAny": false,

image

posted @ 2025-03-06 14:54  暖暖De幸福  阅读(62)  评论(0)    收藏  举报