TypeScript error in /node_modules/@types/babel__traverse/index.d.ts

635 views Asked by At

I get this error web I run react server.I have tried clear cache,downgrading both the react-scripts and typescript.I am new to react and I don't know how to handle this.

312 |         // too complex for TS. So we type it as a general visitor only if the key contains `|`
    313 |         // this is good enough for non-visitor traverse options e.g. `noScope`
  > 314 |         [k: `${string}|${string}`]: VisitNode<S, Node>;
        |             ^
    315 |     };
    316 | 
    317 | export type VisitNode<S, P extends Node> = VisitNodeFunction<S, P> | VisitNodeObject<S, P>;

this is my package.json file

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@types/jest": "24.0.18",
    "@types/node": "12.7.8",
    "@types/react": "16.9.4",
    "@types/react-dom": "16.9.1",
    "axios": "^0.19.0",
    "react": "^16.10.1",
    "react-dom": "^16.10.1",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.1.2",
    "typescript": "3.6.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
1

There are 1 answers

2
Ikram Akbar On

Based on your Problem, You can try this code in the terminal of your project . Use the updated version of TypeScript.

npm install typescript