Reputation: 119
My project was working perfectly well but I went and accidentally deleted my node_modules folder and package-lock.json and then reinstalled everything using npm install
and now I'm getting this error
Type expected. TS1110
149 | failed: true;
150 | };
> 151 | declare type ParamParseSegment<Segment extends string> = Segment extends `${infer LeftSegment}/${infer RightSegment}` ? ParamParseSegment<LeftSegment> extends infer LeftResult ? ParamParseSegment<RightSegment> extends infer RightResult ? LeftResult extends string ? RightResult extends string ? LeftResult | RightResult : LeftResult : RightResult extends string ? RightResult : ParamParseFailed : ParamParseFailed : ParamParseSegment<RightSegment> extends infer RightResult ? RightResult extends string ? RightResult : ParamParseFailed : ParamParseFailed : Segment extends `:${infer Remaining}` ? Remaining : ParamParseFailed;
This is the tsconfig that is in my project. It's the same as it was before when it was working
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"downlevelIteration": true,
},
"include": [
"src"
]
}
Output of tsc -v
is Version 4.5.5
. Output of node -v
is v16.13.0
if that is of any use. I'm thinking I might have broken something related to the TS compiler? I don't think the problem is with the react router library...
Upvotes: 2
Views: 12430
Reputation: 139
Not sure if it's the right way but I solved it by deleting node_modules/@types/react-router
folder.
Upvotes: 0
Reputation: 4141
I have fixed the error by doing the following in my project with storybook
npm i [email protected]
npm i @types/[email protected]
Upvotes: 0
Reputation: 354
If you are using Visual Studio, and combine front-end with backend in one solution, you should check if the version of package Microsoft.TypeScript.MSBuild is up to date.
Upvotes: 0
Reputation: 119
Fixed by uninstalling and reinstalling TS using
npm uninstall typescript --save
npm install typescript --save-dev
Upvotes: 6