【问题标题】:React typescript - Parsing error: Unexpected token - after upgrading to 17.0.1反应打字稿 - 解析错误:意外的令牌 - 升级到 17.0.1 后
【发布时间】:2021-03-18 04:42:26
【问题描述】:

升级后

"react": "^17.0.1",
"react-scripts": "4.0.1"

我的所有类型(或接口)都不再被识别。它与 React "react": "16.13.1" 工作正常@

出现此错误的示例:

  Line 18:3:  Parsing error: Unexpected token

  16 | type Props = {
  17 |   onCancel: () => void
> 18 |   text: string
     |   ^
  19 |   userRoleCompanie: UserRoleCompanie
  20 | }
  21 | 

【问题讨论】:

    标签: reactjs typescript types upgrade


    【解决方案1】:

    我猜你可能已经想通了,但是对于后代:你必须从项目的根目录中删除 .eslintrc 文件。

    【讨论】:

      猜你喜欢
      • 2019-08-07
      • 2020-11-15
      • 2019-10-26
      • 1970-01-01
      • 1970-01-01
      • 2019-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多