警告:您当前运行的 TypeScript 版本不受 @typescript-eslint/typescript-estree 官方支持

Bar*_*oll 49 ubuntu warnings typescript reactjs react-scripts

您好,我的终端出现一些错误,它说我需要使用 4.4.0 版本,而我当前的版本是...

在我的项目中,我当前的打字稿版本如下,

    "typescript": "^4.4.2",
    "typedoc": "^0.21.8",
    "react-scripts": "^3.4.4",
    "@typescript-eslint/eslint-plugin": "^4.29.3",
    "@typescript-eslint/parser": "^4.29.3",

Run Code Online (Sandbox Code Playgroud)

此外,当我尝试运行npm run dev命令或npx eslint 时。错误向我显示,如下所示,

    =============

   WARNING: You are currently running a version of TypeScript which is not 
   officially supported by @typescript-eslint/typescript-estree.

    You may find that it works just fine, or you may not.

   SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <4.4.0

   YOUR TYPESCRIPT VERSION: 4.4.2

     Please only submit bug reports when using the officially supported 
    version.

    =============
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题,我在谷歌上做了很多研究,但没有任何效果。这对我来说会有很大的帮助。

小智 37

我正在为同样的警告而苦苦挣扎。通过运行以下命令将 eslint 和相关包更新到最新版本来解决这个问题:

npm i eslint@latest @typescript-eslint/parser@latest @typescript-eslint/eslint-plugin@latest --save

现在,我的package.json中有以下版本,并且我不再收到警告

"eslint": "^8.38.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.22.0",
"typescript": "^5.0.4"
Run Code Online (Sandbox Code Playgroud)


Ivo*_*Ivo 15

我不会降级我的 Typescript,因为你会错过更新的 TS 功能 - 我会找到一种方法来更新@typescript-eslint/typescript-estree.

您可能没有直接安装它,这可能是另一个包的依赖项,例如,@typescript-eslint/experimental-utils这是依赖项,因此请跟踪文件中的父包并碰撞它,因此它也应该碰撞。@typescript-eslint/eslint-pluginyarn.lock / package.lock@typescript-eslint/typescript-estree


Jhe*_*ano -8

尝试使用 >=3.3.1 <4.4.0 之间的打字稿版本。 这里有可用的打字稿版本列表。

更改版本后,删除node_modules文件夹和package-lock.json文件。然后执行npm install