'Namespace has no exported member 'LocationState'

I get this error when I try to run my TypeScript application:

Namespace '"C:/DevTools/git/motor.ui/node_modules/history/index"' has no exported member 'LocationState'.

This is my package.json:

{
  "name": "motor.ui",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@digital/react-avis-atom": "^2.4.0",
    "@elastic/apm-rum": "^5.6.1",
    "@types/react-router-dom": "^4.3.0",
    "axios": "^0.18.0",
    "classnames": "^2.2.6",
    "moment": "^2.22.2",
    "query-string": "5",
    "react": "^16.4.2",
    "react-dom": "^16.4.2",
    "react-moment": "^0.7.9",
    "react-router-dom": "^4.4.0-alpha.1",
    "react-scripts-avis": "2.16.75"
  },
  "scripts": {
    "start": "react-scripts-avis start",
    "build": "sh -ac '. ./.env.${REACT_APP_ENV}; react-scripts-avis build'",
    "build:sys": "REACT_APP_ENV=sys yarn run build",
    "build:uat": "REACT_APP_ENV=uat yarn run build",
    "build:production": "REACT_APP_ENV=production yarn run build",
    "test": "react-scripts-avis test --env=jsdom",
    "eject": "react-scripts-avis eject",
    "lint": "yarn tslint",
    "tslint": "tslint -t stylish -c tslint.json -e '**/node_modules/**/*' 'src/**/*.+(ts|tsx)'",
    "tslint-fix": "yarn tslint --fix",
    "tslint-staged": "LIST=`git diff-index --cached --name-only HEAD | grep .*\\\\.ts | grep -v json`; if [[ ! -z ${LIST} ]]; then tslint -t stylish $LIST; else echo 'empty'; fi",
    "analyze": "source-map-explorer build/static/js/main.*",
    "uploadSrcMap": "NODE_TLS_REJECT_UNAUTHORIZED=0 node ./tools/sourceMapUploader.js"
  },
  "coverageThreshold": {
    "global": {
      "branches": 90,
      "functions": 90,
      "lines": 90,
      "statements": 90
    }
  },
  "devDependencies": {
    "@types/classnames": "^2.2.6",
    "@types/enzyme": "^3.1.13",
    "@types/enzyme-adapter-react-16": "^1.0.3",
    "@types/jest": "^23.3.1",
    "@types/node": "^10.9.4",
    "@types/react": "^16.4.13",
    "@types/react-dom": "^16.0.7",
    "@types/webpack-env": "^1.13.6",
    "axios-mock-adapter": "^1.15.0",
    "enzyme": "^3.5.0",
    "enzyme-adapter-react-16": "^1.3.1",
    "source-map-explorer": "^1.6.0",
    "typescript": "^3.0.3"
  },
  "homepage": "."
}

How do I resolve this?



Solution 1:[1]

Your version of @types/react-router-dom is too old, try upgrading to a 5.x version.

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 Johannes Charra