Skip to content

TypeScript: @types/express version ambiguity breaks build #685

Closed
@montasaurus

Description

@montasaurus

Related issues

#610

[REQUIRED] Version info

node: v13.12.0

firebase-functions: 3.6.1

firebase-tools: 8.2.0

firebase-admin: ^8.11.0

[REQUIRED] Test case

import * as functions from "firebase-functions";
functions.https.onCall((data, context) => {}); // error TS2707: Generic type 'Request<P>' requires between 0 and 1 type arguments.

[REQUIRED] Steps to reproduce

Upgrade the firebase-functions package to 3.6.1 with @types/express already installed and resolved to version 4.17.3 (which matches the spec for this package). Run tsc and watch the build fail.

[REQUIRED] Expected behavior

The build should succeed.

[REQUIRED] Actual behavior

The build fails because the type signatures have changed in @types/express since the spec version in package.json. Breaking change here: DefinitelyTyped/DefinitelyTyped@bb26736

- 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/adam/code/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>;
                                                                                                                                                                                                                                                              ~~~~~

The DefinitelyTyped bindings don't usually respect SemVer, so they should probably be pinned to a specific version in package.json or locked with package-lock.json.

Were you able to successfully deploy your functions?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions