添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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" "typescript": "3.6.3" <== This version does not support index signatures, you will need at least version 4.4 – Keith Oct 23 at 9:51

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

npm install typescript
                @GilbertIntabo  You have a hard version -> 3.6.3 in your package.json, so it won't make any difference and will just re-install the same version.   Change the package.json to >=4.4.  Note a semantic version of >=4.4 will also install the latest version 5, I find TS major version generally don't break backward compatibility so you should be good.
– Keith
                Oct 23 at 9:56
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.