添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi, I am facing this issue while doing npm install in my application. I had created my app using create-react-app with typescript template. Its been working fine all these days, but when I cloned the repo in new system and did npm install , I am seeing this issue.

TypeScript error in D:/WMS_UI/gitlab/QA/node_modules/@types/babel__traverse/index.d.ts(321,9):
Type expected.  TS1110
    319 |     // too complex for TS. So we type it as a general visitor only if the key contains `|`
    320 |     // this is good enough for non-visitor traverse options e.g. `noScope`
  > 321 |     [k: `${string}|${string}`]: VisitNode<S, Node>;
        |         ^
    322 | };

I am using packages with these versions

"react": "^16.12.0",
"@types/react": "^16.9.25",
"typescript": "3.8.3",
"@babel/core": "^7.22.5",
"@babel/runtime": "^7.7.4",
"babel-eslint": "10.0.3",
"babel-jest": "^24.9.0",
"babel-loader": "8.0.6",
"babel-plugin-named-asset-import": "^0.3.4",
"babel-preset-react-app": "^9.0.2",

Any suggestions on how to fix this issue are much appreciated

khanghh, tju2017lcx, jarredCadsoft, daniel-carvajal, ThinaticSystem, markzporter, jcesarmobile, lesh1j, Kevin-Mok, webbertakken, and 8 more reacted with thumbs up emoji khanghh, tju2017lcx, webbertakken, and nata7che reacted with eyes emoji All reactions

Any updates on this issue? I tried this babel/babel#15678 (comment) but didn't work for me.

Same here, the provided link didn't work for me either. However, I found an alternative solution. After doing an npm install, I am installing a specific version of babel_traverse that solves my issue.

Here are the steps:

  • Perform an npm install.
  • Install the specific version of @types/babel__traverse that is suited for your application's TypeScript version. In my case, it's @types/[email protected] (i.e npm install @types/[email protected])
  • Antonio-Brito-Estrada, osmaoguzhan, nadavl, JhackCosta, prodyut-das-repo, mty-tidjani, nnnagendran, liujunyuan-myob, malandles, gaiksaya, and 3 more reacted with thumbs up emoji prodyut-das-repo, liujunyuan-myob, geekhac, malandles, and Dominick12321 reacted with heart emoji All reactions

    I faced the same issue when I did npm run build

    Installing the specific version of @types/babel__traverse worked for me, but another issue showed up:

    #19 154.5 TypeScript error in /var/app/node_modules/@types/react-router/ts4.6/index.d.ts(124,100):
    #19 154.5 Type expected.  TS1110
    #19 154.5 
    #19 154.5     122 | ): match<Params> | null;
    #19 154.5     123 | 
    #19 154.5   > 124 | export type ExtractRouteOptionalParam<T extends string, U = string | number | boolean> = T extends ${infer Param}?
    #19 154.5         |                                                                                                    ^
    #19 154.5     125 |     ? { [k in Param]?: U }
    #19 154.5     126 |     : T extends `${infer Param}*
    #19 154.5     127 |     ? { [k in Param]?: U }
    

    I faced the same issue when I did npm run build

    Installing the specific version of @types/babel__traverse worked for me, but another issue showed up:

    #19 154.5 TypeScript error in /var/app/node_modules/@types/react-router/ts4.6/index.d.ts(124,100):
    #19 154.5 Type expected.  TS1110
    #19 154.5 
    #19 154.5     122 | ): match<Params> | null;
    #19 154.5     123 | 
    #19 154.5   > 124 | export type ExtractRouteOptionalParam<T extends string, U = string | number | boolean> = T extends ${infer Param}?
    #19 154.5         |                                                                                                    ^
    #19 154.5     125 |     ? { [k in Param]?: U }
    #19 154.5     126 |     : T extends `${infer Param}*
    #19 154.5     127 |     ? { [k in Param]?: U }
    

    I have also faced a similar issue. It was happening because the TypeScript version of my application was less than 4, while react-router-dom was installing @types/react-router with TypeScript version greater than 4. To solve the issue, I had to install a specific version of @types/react-router-dom. The version that worked for me was @types/[email protected] (i.e., npm i @types/[email protected]).

    "@babel/core": "7.9.0",
    "@binance-chain/bsc-connector": "^1.0.3",
    "@ethersproject/providers": "^5.6.6",
    "@solana/wallet-adapter-coin98": "^0.5.4",
    "@svgr/webpack": "4.3.3",
    "@types/babel__core": "7.1.6",
    "@types/babel__traverse": "7.0.9",
    "@types/debounce": "1.2.0",
    "@types/jest": "^26.0.9",
    "@types/node": "^14.0.27",
    "@types/react": "^16.9.46",
    "@types/react-transition-group": "^4.4.4",
    "@types/shallowequal": "^1.1.1",
    "@typescript-eslint/eslint-plugin": "2.10.0",
    "@typescript-eslint/parser": "2.10.0",
    "@web3-react/core": "^6.1.9",
    "antd": "4.3.0",
    "antd-mobile": "5.31.0",
    "babel-eslint": "10.1.0",
    "babel-jest": "24.9.0",
    "babel-loader": "8.1.0",
    "babel-plugin-named-asset-import": "0.3.6",
    "babel-preset-react-app": "9.1.2",
    "bignumber.js": "^9.0.0",
    "camelcase": "5.3.1",
    "case-sensitive-paths-webpack-plugin": "2.3.0",
    "css-loader": "3.4.2",
    "debounce": "^1.2.0",
    "dotenv": "8.2.0",
    "dotenv-expand": "5.1.0",
    "echarts": "^5.4.2",
    "eslint": "6.6.0",
    "eslint-config-react-app": "5.2.1",
    "eslint-loader": "3.0.3",
    "eslint-plugin-flowtype": "4.6.0",
    "eslint-plugin-import": "2.20.1",
    "eslint-plugin-jsx-a11y": "6.2.3",
    "eslint-plugin-react": "7.19.0",
    "eslint-plugin-react-hooks": "1.6.1",
    "file-loader": "4.3.0",
    "fs": "^0.0.1-security",
    "fs-extra": "8.1.0",
    "html-webpack-plugin": "4.0.0-beta.11",
    "identity-obj-proxy": "3.0.0",
    "is-mobile": "^3.0.0",
    "jest": "24.9.0",
    "jest-environment-jsdom-fourteen": "1.0.1",
    "jest-resolve": "24.9.0",
    "jest-watch-typeahead": "0.4.2",
    "less": "3.13.1",
    "less-loader": "7.3.0",
    "mini-css-extract-plugin": "0.9.0",
    "numeral": "^2.0.6",
    "optimize-css-assets-webpack-plugin": "5.0.3",
    "pnp-webpack-plugin": "1.6.4",
    "postcss-flexbugs-fixes": "4.1.0",
    "postcss-loader": "3.0.0",
    "postcss-normalize": "8.0.1",
    "postcss-preset-env": "6.7.0",
    "postcss-safe-parser": "4.0.1",
    "react": "^16.13.1",
    "react-app-polyfill": "^1.0.6",
    "react-circular-progressbar": "^2.0.3",
    "react-countdown": "^2.2.1",
    "react-countup": "^4.3.3",
    "react-dev-utils": "10.2.1",
    "react-dom": "^16.13.1",
    "react-router-dom": "^5.2.0",
    "react-transition-group": "^4.4.2",
    "redux": "^4.1.0",
    "redux-react-hook": "^4.0.3",
    "resolve": "1.15.0",
    "resolve-url-loader": "3.1.1",
    "sass-loader": "8.0.2",
    "semver": "6.3.0",
    "shallowequal": "^1.1.0",
    "style-loader": "0.23.1",
    "styled-components": "^5.1.1",
    "swiper": "^6.8.4",
    "terser-webpack-plugin": "2.3.5",
    "ts-node": "10.8.1",
    "ts-pnp": "1.1.6",
    "typescript": "^3.9.7",
    "url-loader": "2.3.0",
    "use-immer": "^0.5.2",
    "use-wallet": "^0.8.0",
    "web3": "^1.2.11",
    "webpack": "4.42.0",
    "webpack-dev-server": "3.10.3",
    "webpack-manifest-plugin": "2.2.0",
    "workbox-webpack-plugin": "4.3.1"

    I have also encountered this problem. I have tried all the solutions upstairs, but I still hold onto this mistake. Do you have any other ideas? Thank you

    To solve the issue, I had to install a specific version of @types/react-router-dom. The version that worked for me was @types/[email protected] (i.e., npm i @types/[email protected]).

    How did you determine which version of @types/react-router-dom worked for you? I tried 5.3.3 but it didn't fix the issue.

    To solve the issue, I had to install a specific version of @types/react-router-dom. The version that worked for me was @types/[email protected] (i.e., npm i @types/[email protected]).

    How did you determine which version of @types/react-router-dom worked for you? I tried 5.3.3 but it didn't fix the issue.

    My application's TypeScript version is 3.9, so I searched for the @types version that supports TypeScript 3.9. here

    Hi I tried all above steps stil I'm facing same issue , can anyone please suggest any other way's

    TypeScript error in /home/suresh/Desktop/before migration/admin-dashboard/node_modules/@types/babel__traverse/index.d.ts(321,9):
    Type expected.  TS1110
        319 |     // too complex for TS. So we type it as a general visitor only if the key contains `|`
        320 |     // this is good enough for non-visitor traverse options e.g. `noScope`
      > 321 |     [k: `${string}|${string}`]: VisitNode<S, Node>;
            |         ^
        322 | };
        323 | 
        324 | export type VisitNode<S, P extends Node> = VisitNodeFunction<S, P> | VisitNodeObject<S, P>;
      Coder-Devesh-Agarwal, yuri3262, pedrolvr9, xiooLoo, GitCodeCruiser, adeel4u, soybeanxiaobi, xiesamgh, jpuck, rishabh6788, and 4 more reacted with thumbs up emoji
      alexandr-poplavsky reacted with heart emoji
        All reactions