'Upgrading to storybook 6.5 getting react-router typescript error

I am getting react-router typescript error after upgrading the storybook to 6.5 version. Would want to know if any one of you getting the same issue?

Below is my tsconfig.json, and I am using [email protected], some of the research results said that to upgrade it to version 4 (I know the latest storybook version react-router is using typescript 4 above version), but it will cause migration errors, and due to the code base being big, I wonder if there is any other alternative solution on this?

{
  "compilerOptions": {
    "outDir": "dist",
    "sourceMap": true,
    "baseUrl": "src",
    "target": "es5",
    "allowJs": false,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "noEmit": true,
    "jsx": "react",
    "lib": ["dom", "es2016", "es2017"],
    "noFallthroughCasesInSwitch": true,
    "noImplicitReturns": true,
    "strictFunctionTypes": false,
    "downlevelIteration": true,
    "declaration": true,
    "noUnusedLocals": false,
    "noImplicitAny": false,
    "declarationDir": "dist/types",
    "typeRoots": ["node_modules/@types", "src/typings.d.ts"],
  },
  "include": ["src"],
  "exclude": [
    "node_modules",
    "./node_modules",
    "./node_modules/*",
    "./node_modules/@storybook/router/node_modules/react-router/index.d.ts" <== I am trying to exlucde the type error from this file
  ]
}


Solution 1:[1]

Upgrading typescript to latest work for me ( current latest is 4.6.2 )

npm install typescript@latest

Also tried to work around with react-router or upgrading react and react-dom to latest, but no luck.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1