代码之家  ›  专栏  ›  技术社区  ›  ocuenca

在tsconfig.json中找不到“redux logger”错误的类型定义文件

  •  1
  • ocuenca  · 技术社区  · 6 年前

    typescript 包和现在的 tsconfig.json

    找不到“redux logger”的类型定义文件

    我试图在这里和google搜索这个问题,但是我找不到tsconfig.json中需要包含的内容。这是文件的内容:

    {
      "compilerOptions": {
        "outDir": "build/dist",
        "module": "esnext",
        "target": "es5",
        "lib": ["es6", "dom"],
        "sourceMap": true,
        "allowJs": true,
        "jsx": "react",
        "moduleResolution": "node",
        "rootDir": ".",
        "forceConsistentCasingInFileNames": true,
        "noImplicitReturns": true,
        "noImplicitThis": true,
        "noImplicitAny": true,
        "strictNullChecks": true,
        "suppressImplicitAnyIndexErrors": true,
        "noUnusedLocals": true,
        "allowSyntheticDefaultImports": true,
      },
      "exclude": [
        "node_modules",
        "build",
        "scripts",
        "acceptance-tests",
        "webpack",
        "jest",
        "src/setupTests.ts"
      ],
      "include": [
          "./src/**/*"
      ]
    }
    

    error

    以下是npm包的版本:

    {
      "name": "documentloader",
      "version": "1.0.0",
      "private": true,
      "dependencies": {
        "@material-ui/core": "^3.0.3",
        "@material-ui/icons": "^3.0.1",
        "react": "16.5.2",
        "react-dom": "16.5.2",
        "react-redux": "^5.0.7",
        "react-redux-loading-bar": "^4.0.8",
        "react-router-dom": "^4.3.1",
        "react-scripts-ts": "latest",
        "react-toastify": "^4.4.0",
        "react-transition-group": "^2.5.0",
        "redux": "^4.0.1",
        "redux-logger": "^3.0.6",
        "redux-persist": "^5.10.0",
        "redux-saga": "^0.16.2",
        "redux-thunk": "^2.3.0",
        "ts-loader": "^5.2.2"
      },
      "devDependencies": {
        "@types/classnames": "^2.2.6",
        "@types/history": "^4.7.1",
        "@types/jest": "^23.3.5",
        "@types/node": "10.12.0",
        "@types/ramda": "^0.25.39",
        "@types/react": "16.4.18",
        "@types/react-dom": "^16.0.9",
        "@types/react-redux": "^6.0.9",
        "@types/react-router-dom": "^4.3.1",
        "@types/redux-logger": "^3.0.6",
        "@types/webpack-env": "^1.13.6",
        "awesome-typescript-loader": "^5.2.1",
        "css-loader": "^1.0.0",
        "csstype": "^2.5.7",
        "file-loader": "^2.0.0",
        "html-webpack-plugin": "^3.2.0",
        "redux-devtools-extension": "^2.13.5",
        "source-map-loader": "^0.2.4",
        "style-loader": "^0.23.1",
        "typescript": "^3.1.3",
        "webpack": "^4.20.2",
        "webpack-cli": "^3.1.2",
        "webpack-dev-middleware": "^3.4.0",
        "webpack-dev-server": "^3.1.9",
        "webpack-hot-middleware": "^2.24.3"
      }
     }
    

    更新

    @types/redux logger文件夹的内容: folder

    1 回复  |  直到 6 年前
        1
  •  0
  •   Matt McCutchen    6 年前

    这个错误很可能意味着 typeRoots mechanism 找到一个似乎表示名为的包的目录 @types/redux-logger node_modules/@types/redux-logger ,尝试删除它。