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

问题描述 投票:0回答:2

我有一个使用 Typescript 的 Monorepo。我有一个 common 文件夹,它在文件顶部显示此错误 ->

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",
]
}

有什么建议吗?

typescript react-native tsconfig monorepo
2个回答
15
投票

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


0
投票

在您的“编译器选项”中包含“类型”...

{
  "compilerOptions": {
    "types": [
      // ... your other types
      "node"
    ],
  },
}
© www.soinside.com 2019 - 2024. All rights reserved.