Eslint 无法识别 "as" 运算符

Eslint doesn't recognize "as" operator

我无法理解为什么 eslint 无法识别“as”运算符。

正如您在上图中看到的,它只是给我这个一般的“意外标记”错误,它甚至与运算符误用无关。

这是我的“eslintrc.js”文件的图片:

如果您使用 Typescript 编写,请查看我的 eslintrc 并获取您需要的内容:

{
    "parser": "@typescript-eslint/parser",
    "extends": [
        "plugin:react/recommended",
        "plugin:@typescript-eslint/recommended",
        "prettier/@typescript-eslint",
        "plugin:prettier/recommended"
    ],
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        },
        "ecmaVersion": 2020,
    },
    "rules": {

    },
    "settings": {
        "react": {
            "version": "detect"
        }
    },
    "env": {
        "browser": true,
        "es6": true
    },
}

如果不是,请删除as HTMLElement,因为javascript无法处理