Ts4.1 字符串模板类型,Eslint解析错误

最近试了一下Ts4.1新增的字符串模板语法,能使用,类型也能正确解析出来,但是eslint一直报解析错误
image.png

代码是官网的一个案例

type Color = "red" | "blue";
type Quantity = "one" | "two";
type SeussFish = `${Quantity | Color} fish`;
// package.json 

    "@typescript-eslint/eslint-plugin": "^4.0.1",
    "@typescript-eslint/parser": "^4.0.1",
    "eslint": "^7.8.1",
    "eslint-config-airbnb": "^18.2.0",
    "eslint-config-prettier": "^6.11.0",

是不是需要添加什么新的语法解析器或者配置啥东西

阅读 3.3k
1 个回答

升级下
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",

推荐问题