skip to Main Content

I am trying to integrate TypeScript into my React project, created with CRA.
I keep having the following error:

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

I have tried updating

@typescript-eslint/eslint-plugin
@typescript-eslint/parser

to v6 as suggested in several places, but it didn’t solve the issue.

Here’s the partial package.json:

"dependencies": {
    "@emotion/react": "^11.10.5",
    "@emotion/styled": "^11.10.5",
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.3.0",
    "@testing-library/user-event": "^13.5.0",
    "@trivago/prettier-plugin-sort-imports": "^4.0.0",
    "env-cmd": "^10.1.0",
    "eslint": "^8.56.0",
    "node-sass": "^8.0.0",
    "papaparse": "^5.4.1",
    "react": "^18.1.0",
    "react-dom": "^18.1.0",
    "react-dropzone": "^14.2.3",
    "react-router-dom": "^6.3.0",
    "react-scripts": "5.0.1",
    "sass": "^1.52.1",
    "sass-vars-to-js-loader": "^2.1.1",
    "web-vitals": "^2.1.4"
  },
  "devDependencies": {
    "@types/react": "^18.2.46",
    "@types/react-dom": "^18.2.18",
    "@typescript-eslint/eslint-plugin": "^6.18.0",
    "@typescript-eslint/parser": "^6.18.0",
    "prettier": "^2.8.0",
    "typescript": "^5.3.3"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },

2

Answers


  1. This is resolved by upgrading to typescript-eslint@6. See Parsing error: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used.

    If you’re still seeing this error, it means that somewhere in your installed packages, an older typescript-eslint version is floating around. Try:

    • Bumping versions of all packages that mention ESLint and/or TypeScript
    • Clearing your node_modules/ directory and re-installing
    • Clearing whatever lockfile your package manager uses (package-lock.json, pnpm-lock.yaml, yarn.lock, etc.) and re-installing

    If all else fails, you can set package.json overrides or an equivalent feature for your package manager of choice – to make sure all typescript-eslint packages mentioned in your lockfile are set to v6. But this really should not be necessary. Most of the time, this issue is from out of date packages.

    Login or Signup to reply.
  2. After following @Josh’s suggestion above, I found out that the issue for me was stemming from an outdated version of dependency-cruiser. Per their release notes:

    6276288 chore(extract): makes ‘require’ detection with typescript >5.2.0 as well (#811)
    -> this fixes the DeprecationWarning: ‘originalKeywordKind’ has been deprecated since v5.0.0 and will no longer be usable after v5.2.0. Use ‘identifierToKeywordKind(identifier)’ instead. typescript/ tsc warning some of you might’ve been getting.

    After upgrading from v13.0.2 to the latest version, this error went away. Hope that helps!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search