Error: TypeScript error in /home/runner/work/avi/avi/node_modules/@types/react-router/index.d.ts(149,100): Type expected. TS1110

Viewed 1121

When I build my react project I get an error like this.

export type ExtractRouteOptionalParam<T extends string, U = string | number | boolean> = T extends `${infer Param}?`      
  ? { [k in Param]?: U }
  : T extends `${infer Param}*`
  ? { [k in Param]?: U }

Build log

How to solve this?

3 Answers

I am adding an answer for future reference for others.

Yes like others mentioned typescript was the issue.

I upgraded it to the latest version (currently 4.8.3). After upgrading, I had to fix a type issue on my redux saga file and I had to upgrade react-scripts to 4.0.1 to fix the Parsing error: Cannot read properties of undefined (reading 'map').

enter image description hereI meet seem issue on yesterday. And I use typescript version is 3.9.3. I had try version 3.9.10 cannot sovle this problem

I updated typescript version to 4.1.6 and it worked for me. I tried newest version of typescript. It also works, but it doesn't support all the features I need.

Related