Parsing error: DeprecationError: ‘originalKeywordKind’ has been deprecated since v5.0.0 and can no longer be used. Use ‘identifierToKeywordKind(identifier)’ instead.

Next.js13のtypescriptのバージョンをアップグレードしたら、

Parsing error: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.

のエラーが出たので、試した方法と解決方法をまとめます。

目次

問題

Next.js13のtypescriptのバージョンを4.9.5から5.3.3に上げてビルドをしたら、このようなエラーが出ました。

Failed to compile.

./pages/_app.tsx
Error: Parsing error: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.

このエラーが出た理由は以下のとおりです。

5.2にアップグレードしたら、リンティングが失敗するようになった:

DeprecationError: ‘originalKeywordKind’はv5.0.0から非推奨になりました。代わりに’identifierToKeywordKind(identifier)’を使用してください。
5.2以前では、これは警告でした:

DeprecationWarning:’originalKeywordKind’はv5.0.0から非推奨となり、v5.2.0以降は使用できなくなりました。代わりに’identifierToKeywordKind(identifier)’を使用してください。
ESLintがスタック・トレースを提供してくれないので、これらのエラーがどこから来ているのか突き止めるのに苦労した。

元の問題で言及されていないので、このことを述べました。これはあなたの責任ですか?(もしこれが真っ赤な嘘だったらごめんなさい…。ESLintが–debugなどを使っても明確なスタックトレースを出してくれなかったので、rg –no-ignoreのoriginalKeywordKind系のもので推測作業をたくさんしなければなりませんでした)

https://github.com/typescript-eslint/typescript-eslint/issues/7155#issuecomment-1692384149
GitHub
TypeScript 5.2 Support · Issue #7155 · typescript-eslint/typescript-eslint https://devblogs.microsoft.com/typescript/announcing-typescript-5-2-rc/ This issue is just to track all of the new features and their implementation state in th...

解決方法

結局解決した方法は、以下のように元のバージョンに戻すことでした。

    "eslint": "8.33.0",
    ...
    "typescript": "4.9.5"

試して解決しなかった方法

@typescript-eslint/eslint-pluginや@typescript-eslint/parserをインストールしても解決しませんでした。

Stack Overflow
Parsing error: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no l... When upgrading an existing React project I'm getting the following error at line 0 of every .tsx file. Parsing error: DeprecationError: 'originalKeywordKind' ha...

また、eslintのバージョンを上げてもだめでした。

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

コメント

コメントする


The reCAPTCHA verification period has expired. Please reload the page.

目次