Check your package.json to ensure you're using a current version of the typescript package
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
same problem with spfx verion 1.13.1 and react-router-dom 6.2.1 and typescript Version 4.5.4.
[16:04:24] Error - [tsc] node_modules/react-router/index.d.ts(151,74): error TS1110: Type expected.
[16:04:24] Error - [tsc] node_modules/react-router/index.d.ts(151,83): error TS1005: '}' expected.
[16:04:24] Error - [tsc] node_modules/react-router/index.d.ts(151,94): error TS1128: Declaration or statement expected.
[16:04:24] Error - [tsc] node_modules/react-router/index.d.ts(151,96): error TS1161: Unterminated regular expression literal.
[16:04:24] Error - 'tsc' sub task errored after 3.85 s
any idea how to fix this?
Hi @Akshay koul ,
As I've mentioned in my reply above, react-router-dom won't work with the latest version, but you'll need to target version 5.3.0:
npm i react-router-dom@5.3.0
npm i @types/react-router-dom
In your case you'll need to first uninstall your installed version of react-router-dom.
Let me know how you go?