【发布时间】:2020-08-18 18:05:43
【问题描述】:
使用 Firebase 云功能运行 firebase deploy 时出现 4 个错误。
错误来自我没有接触过的文件。
node_modules/firebase-functions/lib/function-builder.d.ts:64:136 - error TS2707: Generic type 'Request<P>' requires between 0 and 1 type arguments.
64 onCall: (handler: (data: any, context: https.CallableContext) => any) => import("./cloud-functions").TriggerAnnotated & ((req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("express-serve-static-core").Query>, resp: express.Response<any>) => void) & import("./cloud-functions").Runnable<any>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/firebase-functions/lib/function-builder.d.ts:64:252 - error TS2694: Namespace '"/Users/harrisa/dev/apps/exerciser/functions/node_modules/@types/express-serve-static-core/index"' has no exported member 'Query'.
64 onCall: (handler: (data: any, context: https.CallableContext) => any) => import("./cloud-functions").TriggerAnnotated & ((req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("express-serve-static-core").Query>, resp: express.Response<any>) => void) & import("./cloud-functions").Runnable<any>;
~~~~~
node_modules/firebase-functions/lib/handler-builder.d.ts:21:36 - error TS2707: Generic type 'Request<P>' requires between 0 and 1 type arguments.
21 onRequest: (handler: (req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("express-serve-static-core").Query>, resp: express.Response<any>) => void) => HttpsFunction;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/firebase-functions/lib/handler-builder.d.ts:21:152 - error TS2694: Namespace '"/Users/harrisa/dev/apps/exerciser/functions/node_modules/@types/express-serve-static-core/index"' has no exported member 'Query'.
21 onRequest: (handler: (req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("express-serve-static-core").Query>, resp: express.Response<any>) => void) => HttpsFunction;
我已尝试更新 firebase 函数和 firebase admin npm 包,但错误仍然存在。
这些错误是在从 npm 中删除一些包后出现的。但是,我将 git 中的更改恢复到正常工作的状态,但错误仍然存在。 任何帮助将不胜感激
编辑:
我设法在question 和特别是Adding skipLibCheck to the project's generated functions/tsconfig.json 之后解决了这个问题
我仍然认为这只是忽略了问题,但它现在有效。
【问题讨论】:
标签: typescript firebase npm