【问题标题】:Parsing error: '=' expected in `import type`解析错误:“导入类型”中需要“=”
【发布时间】:2020-05-07 01:02:00
【问题描述】:

我在 TS 中使用 create-react-app 并执行 import type 但 eslint 在 VS Code 中抱怨说 Parsing error: '=' expected 悬停在 type 中时 import type。我正在使用 eslint,6.7.2

【问题讨论】:

    标签: create-react-app eslint typescript-eslint


    【解决方案1】:

    更新@typescript-eslint/parser@typescript-eslint/eslint-plugin 的最新版本现在支持该语法。


    对 TS import type 语法的 ESLint 支持正在进行中。

    问题:https://github.com/typescript-eslint/typescript-eslint/issues/1436

    拉取请求:https://github.com/typescript-eslint/typescript-eslint/pull/1465

    【讨论】:

    • 谢谢!看来得等它发布了,和CRA整合了。
    • 这个问题解决了吗?看起来它来自 typescript-eslint 的这个 PR:github.com/typescript-eslint/typescript-eslint/pull/1697 但更新到最新版本并没有为我解决这个问题
    • @Christopher 在我的电脑上可以用,你可以试试npm i @typescript-eslint/parser@latest @typescript-eslint/eslint-plugin@latest吗?
    • @golopot 任何其他想法,为什么更新到最新版本后它可能会失败?
    • 即使在更新到 @typescript-eslint/parser@latest @typescript-eslint/eslint-plugin@latest 之后,我今天也看到了同样的问题
    猜你喜欢
    • 2012-06-01
    • 1970-01-01
    • 2014-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-13
    • 2014-10-27
    相关资源
    最近更新 更多