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",

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题