Skip to content

Commit

Permalink
httpsCallable type cleanup (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhuleatt authored Sep 14, 2021
1 parent 134e497 commit 8a3efd1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import { map } from 'rxjs/operators';
type Functions = import('firebase/functions').Functions;
type HttpsCallableOptions = import('firebase/functions').HttpsCallableOptions;

export function httpsCallable<T, R>(
export function httpsCallable<RequestData = unknown, ResponseData = unknown>(
functions: Functions,
name: string,
options?: HttpsCallableOptions,
): (data: T) => Observable<R> {
const callable = vanillaHttpsCallable(functions, name, options);
return (data: T) => {
return from(callable(data)).pipe(map(r => r.data as R));
): (data?: RequestData | null) => Observable<ResponseData> {
const callable = vanillaHttpsCallable<RequestData, ResponseData>(functions, name, options);
return (data) => {
return from(callable(data)).pipe(map(r => r.data));
};
}

0 comments on commit 8a3efd1

Please sign in to comment.