capawesome-team / capacitor-firebase

⚡️ Firebase plugins for Capacitor. Supports Android, iOS and the Web.
https://capawesome.io/plugins/firebase/
Apache License 2.0
367 stars 90 forks source link

feat: cloud functions generic types #663

Closed mamillastre closed 1 day ago

mamillastre commented 2 days ago

Plugin(s)

Current problem

In the plugin, the request data and the response data are typed as any.

Preferred solution

Like the JS SDK, we can add the generic type: <RequestData = unknown, ResponseData = unknown>

Alternative options

No response

Additional context

No response

Before submitting

robingenz commented 2 days ago

So you just want to replace any with unkown or what do you mean byRequestData/ResponseData?

export interface CallOptions {
  /**
   * The data to pass to the callable function.
   *
   * @since 6.1.0
   */
-  data?: any;
+  data?: unknown;
}
mamillastre commented 2 days ago

No a generic type like:

export interface CallOptions<T = unknow> {
  data?: T;
}

I currently make the dev, I will create the PR shortly.

robingenz commented 2 days ago

Alright!