Skip to content

Commit 15cb32e

Browse files
committed
Stream type defaults to unknown
1 parent 58b0dff commit 15cb32e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/common/providers/https.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export interface CallableRequest<T = any> {
156156
* CallableProxyResponse allows streaming response chunks and listening to signals
157157
* triggered in events such as a disconnect.
158158
*/
159-
export interface CallableResponse<T = string> {
159+
export interface CallableResponse<T = unknown> {
160160
/**
161161
* Writes a chunk of the response body to the client. This method can be called
162162
* multiple times to stream data progressively.
@@ -721,7 +721,7 @@ export interface CallableOptions<T = any> {
721721
}
722722

723723
/** @internal */
724-
export function onCallHandler<Req = any, Res = any, Stream = string>(
724+
export function onCallHandler<Req = any, Res = any, Stream = unknown>(
725725
options: CallableOptions<Req>,
726726
handler: v1CallableHandler | v2CallableHandler<Req, Res, Stream>,
727727
version: "gcfv1" | "gcfv2"
@@ -742,7 +742,7 @@ function encodeSSE(data: unknown): string {
742742
}
743743

744744
/** @internal */
745-
function wrapOnCallHandler<Req = any, Res = any, Stream = string>(
745+
function wrapOnCallHandler<Req = any, Res = any, Stream = unknown>(
746746
options: CallableOptions<Req>,
747747
handler: v1CallableHandler | v2CallableHandler<Req, Res, Stream>,
748748
version: "gcfv1" | "gcfv2"

src/v2/providers/https.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ export type HttpsFunction = ((
258258
/**
259259
* Creates a callable method for clients to call using a Firebase SDK.
260260
*/
261-
export interface CallableFunction<T, Return, Stream = string> extends HttpsFunction {
261+
export interface CallableFunction<T, Return, Stream = unknown> extends HttpsFunction {
262262
/** Executes the handler function with the provided data as input. Used for unit testing.
263263
* @param data - An input for the handler function.
264264
* @returns The output of the handler function.
@@ -392,7 +392,7 @@ export function onRequest(
392392
* @param handler - A function that takes a {@link https.CallableRequest}.
393393
* @returns A function that you can export and deploy.
394394
*/
395-
export function onCall<T = any, Return = any | Promise<any>, Stream = string>(
395+
export function onCall<T = any, Return = any | Promise<any>, Stream = unknown>(
396396
opts: CallableOptions<T>,
397397
handler: (request: CallableRequest<T>, response?: CallableResponse<Stream>) => Return
398398
): CallableFunction<T, Return extends Promise<unknown> ? Return : Promise<Return>, Stream>;
@@ -402,10 +402,10 @@ export function onCall<T = any, Return = any | Promise<any>, Stream = string>(
402402
* @param handler - A function that takes a {@link https.CallableRequest}.
403403
* @returns A function that you can export and deploy.
404404
*/
405-
export function onCall<T = any, Return = any | Promise<any>, Stream = string>(
405+
export function onCall<T = any, Return = any | Promise<any>, Stream = unknown>(
406406
handler: (request: CallableRequest<T>, response?: CallableResponse<Stream>) => Return
407407
): CallableFunction<T, Return extends Promise<unknown> ? Return : Promise<Return>>;
408-
export function onCall<T = any, Return = any | Promise<any>, Stream = string>(
408+
export function onCall<T = any, Return = any | Promise<any>, Stream = unknown>(
409409
optsOrHandler: CallableOptions<T> | ((request: CallableRequest<T>) => Return),
410410
handler?: (request: CallableRequest<T>, response?: CallableResponse<Stream>) => Return
411411
): CallableFunction<T, Return extends Promise<unknown> ? Return : Promise<Return>> {

0 commit comments

Comments
 (0)