From 1c75878620bbfd56d1c8f541612edf693bb714d4 Mon Sep 17 00:00:00 2001 From: unao Date: Thu, 24 Jan 2019 07:19:47 +0100 Subject: [PATCH] adds option to specify shape of callable function params and result, defaulting to any (#1853) --- src/index.d.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index b88ccca8..f2088b2e 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -2188,17 +2188,18 @@ declare module 'react-native-firebase' { /** * An HttpsCallableResult wraps a single result from a function call. */ - interface HttpsCallableResult { - readonly data: any; + interface HttpsCallableResult { + readonly data: R; } /** * An HttpsCallable is a reference to a "callable" http trigger in * Google Cloud Functions. */ - interface HttpsCallable { - (data?: any): Promise; - } + type HttpsCallable = + Params extends void ? + () => Promise> : + (data: Params) => Promise> /** * `FirebaseFunctions` represents a Functions app, and is the entry point for @@ -2212,7 +2213,7 @@ declare module 'react-native-firebase' { * @param name The name of the https callable function. * @return The `HttpsCallable` instance. */ - httpsCallable(name: string): HttpsCallable; + httpsCallable(name: string): HttpsCallable; /** * Changes this instance to point to a Cloud Functions emulator running