typescript - Firebase 使用 typescript 在函数构建器和句柄构建器中部署错误
问题描述
firebase deploy
使用 firebase 云功能运行时出现 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 中的更改恢复到正常工作的状态,但错误仍然存在。任何帮助将非常感激
编辑:
我设法解决了这个问题之后的问题,特别是Adding skipLibCheck to the project's generated functions/tsconfig.json
我仍然认为这只是忽略了这个问题,但它现在有效。
解决方案
回到稳定版本。我做出这个决定是为了解决它。
"firebase-admin": "8.9.2",
"firebase-functions": "3.3.0",
推荐阅读
- unix - 如何通过简单的步骤在 Unix 中获取上个月的最后一天
- node.js - 在现有 node.js 脚本中放置 for 循环的位置
- node.js - Call subscription's informations from Checkout client in Stripe
- vb.net - ListView Right-to-Left Mode Images Problem
- java - How to use Jackson to parse JSON from Rest Web Service
- docker - 我可以在执行运行时让 docker 拉动吗?
- javascript - 单击按钮后,模态主体不会在 html 中呈现组件
- ios - UIButton 框架不会随着使用 Swift 5 的可访问性大字体而增加
- django - 变量形式 action="/"
- mongodb - Upsert 带有条件的对象的 mongo 数组