类型“Window”上不存在属性“wx”。ts(2339

eslint报错

1,类型“Window”上不存在属性“wx”。ts(2339)

image.png

解决:根目录新建文件:类型定义文件(.d.ts*) .d.ts
.d.ts

interface Window {
  wx: string;
}

2,类型“Readonly<{}>”上不存在属性“merId”。


image.png
  • 只要在组件内部使用了props和state,就需要在声明组件时指明其类型。
    解决:
    (一)
class MerList extends PureComponent<{dispatch,spending},{merId:string,merName:string}>{
}

改成
(二)

export interface MerlistState {
  merId: string;
  merName: string;
}

@connect(({ spending }) => ({
  spending,
  // loading,
}))
class MerList extends PureComponent{
  constructor(props) {
    super(props);
    this.state = {
      merId:'',
      merName:''
    };
  }
}

你可能感兴趣的:(类型“Window”上不存在属性“wx”。ts(2339)