我有一个在Firebase函数上运行的TypeScript项目。
这是我的tsconfig.json
{
"compilerOptions": {
"lib": ["es2017"],
"module": "commonjs",
"noImplicitReturns": true,
"outDir": "dist",
"sourceMap": true,
"target": "es2017",
"esModuleInterop": true,
"strict": true
},
"include": ["src"],
"exclude": ["dist", "node_modules"]
}
当我构建时(npm run build,它运行tsc)
我得到了错误
node_modules/@types/glob/index.d.ts:29:42 -错误TS 2694:命名空间“/opt/workspace/personal/kioskify-backend/functions/node_modules/minimatch/dist/cjs/index”没有导出的成员“IOptions”。
29接口IOptions扩展minimatch.IOptions {
EDIT:错误发生在其他模块。完整输出:
npm run build
> build
> npm run lint && tsc
> lint
> eslint --fix .
node_modules/@types/glob/index.d.ts:29:42 - error TS2694: Namespace '"/opt/workspace/personal/kioskify-backend/functions/node_modules/minimatch/dist/cjs/index"' has no exported member 'IOptions'.
29 interface IOptions extends minimatch.IOptions {
~~~~~~~~
node_modules/@types/glob/index.d.ts:75:30 - error TS2724: '"/opt/workspace/personal/kioskify-backend/functions/node_modules/minimatch/dist/cjs/index"' has no exported member named 'IMinimatch'. Did you mean 'Minimatch'?
75 minimatch: minimatch.IMinimatch;
~~~~~~~~~~
node_modules/@types/rimraf/index.d.ts:33:21 - error TS2694: Namespace '"/opt/workspace/personal/kioskify-backend/functions/node_modules/glob/dist/mjs/index"' has no exported member 'IOptions'.
33 glob?: glob.IOptions | false | undefined;
~~~~~~~~
Found 3 errors in 2 files.
Errors Files
2 node_modules/@types/glob/index.d.ts:29
1 node_modules/@types/rimraf/index.d.ts:33
和其他类似的错误,可以是什么?
2条答案
按热度按时间biswetbf1#
删除
rimraf
解决了这个问题。hts6caw32#
我认为glob包的类型定义有问题。看起来glob包试图使用minimatch包中的类型定义,但该类型定义没有正确导出。
请尝试将
@types/glob
软件包更新到较新版本。这应该可以工作。如果这不起作用,尝试将
@types/glob
包显式地从编译过程中排除,方法是将其添加到tsconfig.json
文件的排除数组中。