tsconfig.json 显示错误:隐式类型库“glob”的入口点

Jos*_*hua 12 typescript tsconfig react-native monorepo

我有一个使用 Typescript 的 Monorepo。我有一个公共文件夹,它在文件顶部显示此错误 -> Entry point for implicit type library 'glob'。我不确定配置有什么问题。

截屏:

在此输入图像描述

tsconfig.json

{
"extends": "../../tsconfig.json",
"compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "isolatedModules": true,
    "jsx": "react-native",
    "lib": [
        "es2021"
    ],
    "moduleResolution": "node",
    "noEmit": false,
    "strict": true,
    "target": "esnext",
    "composite": true,
    "rootDir": ".",
    "outDir": "dist",
    "declaration": true,
    "emitDeclarationOnly": true,
    "declarationMap": true
},
"exclude": [
    "node_modules",
]
}
Run Code Online (Sandbox Code Playgroud)

有什么建议么?

Jos*_*hua 34

我刚刚重新启动 VS Code,错误就消失了。

  • 然后3分钟后,它又回来了。 (3认同)
  • 哈哈。非常感谢您,在找到许多解决方案后 (2认同)

小智 12

在“compilerOptions”中包含“types”...

{
  "compilerOptions": {
    "types": [
      // ... your other types
      "node"
    ],
  },
}
Run Code Online (Sandbox Code Playgroud)