Type string trivially inferred from a string literal, remove type annotation @typescript-eslint

Vue project startup error

insert image description here
The string type is simply inferred from the string literal, removing type annotations. eslint @ typescript-eslint / no-inferrable-types
The compiler thinks that it has been inferred to be a string type, so there is no need to write

solution

Modify .eslintrc.jsit to add:

  rules: {
    
    
    "@typescript-eslint/no-inferrable-types": "off" // 关闭类型推断
  }

Guess you like

Origin blog.csdn.net/lianghecai52171314/article/details/132384287