fix(v2): re-export express Response from the https provider - #1947
Open
kyungseopk1m wants to merge 1 commit into
Open
fix(v2): re-export express Response from the https provider#1947kyungseopk1m wants to merge 1 commit into
kyungseopk1m wants to merge 1 commit into
Conversation
onRequest handlers are typed with express.Response, but only Request was re-exported. Annotating a handler parameter meant adding express as a direct dependency just to name the type. v1 already re-exports Response from cloud-functions.ts. Do the same here so both generations expose it.
shettyvarun268
approved these changes
Aug 13, 2026
shettyvarun268
left a comment
Contributor
There was a problem hiding this comment.
Nit: Not a blocker at all since its a small change, but we can have a small type assertion test to ensure that Response export does not regress in future refactors.
LGTM otherwise!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
onRequesthandlers take anexpress.Response, butsrc/v2/providers/https.tsonly re-exportsRequest. To annotate a handler parameter you have to addexpressas a direct dependency just to name the type, even thoughfirebase-functionsalready depends on it.v1 does not have this gap:
src/v1/cloud-functions.tsre-exports bothRequestandResponse, sofunctions.Responseresolves today. This brings v2 in line.Responseis re-exported fromexpressrather than aliased asexport type Response = express.Response, because the express type is generic (Response<ResBody, Locals, StatusCode>) and an alias drops the type parameters, which makeshttps.Response<MyBody>fail with TS2315.Fixes #1798.
Code sample
Before, this needs express installed and imported directly:
After:
Scenarios Tested
npm run buildandnpm run lintpass.Checked the emitted surface rather than only the source: after building, a probe importing
httpsfromlib/v2/indexand usinghttps.Response<{ ok: boolean }>, barehttps.Response,https.Request, and a full handler signature type checks withtsc --noEmit. The generic form is what fails on an alias, so it is the case that matters here.Release notes
relnote: fix(v2): re-export the express
Responsetype fromfirebase-functions/v2/https(#1798)