Unexpected aliasing of ‘this‘ to local variable.

“this”到局部变量的意外别名

.eslintrc.js

"@typescript-eslint/no-this-alias": [
    "error",
    {
      "allowDestructuring": false, // Disallow `const { props, state } = this`; true by default
      "allowedNames": ["that"] // Allow `const self = this`; `[]` by default
    }
],

上面代码和 rules规则同级

这样页面上声明 let that = this; 就不会报错了

const that = this;

猜你喜欢

转载自blog.csdn.net/m0_61087678/article/details/128384011
今日推荐