Skip to content

fix: improve v2 callable typing#328

Open
IzaakGough wants to merge 2 commits into
masterfrom
@invertase/fix-improve-v2-callable-typing
Open

fix: improve v2 callable typing#328
IzaakGough wants to merge 2 commits into
masterfrom
@invertase/fix-improve-v2-callable-typing

Conversation

@IzaakGough

Copy link
Copy Markdown

Fixes #257

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the TypeScript types for wrapping v2 callable Cloud Functions to support generic input and return types (T and Return), replacing the previous usage of any. It introduces a new WrappedV2CallableRequest<T> type to represent the wrapped request object. The reviewer feedback suggests several improvements to enhance usability and safety: making the data property optional when the input type T can be undefined, renaming the parameter of WrappedV2CallableFunction from data to request (and making it optional), and safely handling potential undefined request arguments at runtime within wrapV2 to prevent crashes.

Comment thread src/v2.ts Outdated
Comment thread src/v2.ts
Comment thread src/v2.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants