Skip to content

Commit 5d98b66

Browse files
committed
Stream type defaults to unknown
1 parent 62f7609 commit 5d98b66

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.
@@ -720,7 +720,7 @@ export interface CallableOptions {
720720
}
721721

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

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

src/v2/providers/https.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export type HttpsFunction = ((
226226
/**
227227
* Creates a callable method for clients to call using a Firebase SDK.
228228
*/
229-
export interface CallableFunction<T, Return, Stream = string> extends HttpsFunction {
229+
export interface CallableFunction<T, Return, Stream = unknown> extends HttpsFunction {
230230
/** Executes the handler function with the provided data as input. Used for unit testing.
231231
* @param data - An input for the handler function.
232232
* @returns The output of the handler function.
@@ -360,7 +360,7 @@ export function onRequest(
360360
* @param handler - A function that takes a {@link https.CallableRequest}.
361361
* @returns A function that you can export and deploy.
362362
*/
363-
export function onCall<T = any, Return = any | Promise<any>, Stream = string>(
363+
export function onCall<T = any, Return = any | Promise<any>, Stream = unknown>(
364364
opts: CallableOptions,
365365
handler: (request: CallableRequest<T>, response?: CallableResponse<Stream>) => Return
366366
): CallableFunction<T, Return extends Promise<unknown> ? Return : Promise<Return>, Stream>;
@@ -370,10 +370,10 @@ export function onCall<T = any, Return = any | Promise<any>, Stream = string>(
370370
* @param handler - A function that takes a {@link https.CallableRequest}.
371371
* @returns A function that you can export and deploy.
372372
*/
373-
export function onCall<T = any, Return = any | Promise<any>, Stream = string>(
373+
export function onCall<T = any, Return = any | Promise<any>, Stream = unknown>(
374374
handler: (request: CallableRequest<T>, response?: CallableResponse<Stream>) => Return
375375
): CallableFunction<T, Return extends Promise<unknown> ? Return : Promise<Return>>;
376-
export function onCall<T = any, Return = any | Promise<any>, Stream = string>(
376+
export function onCall<T = any, Return = any | Promise<any>, Stream = unknown>(
377377
optsOrHandler: CallableOptions | ((request: CallableRequest<T>) => Return),
378378
handler?: (request: CallableRequest<T>, response?: CallableResponse<Stream>) => Return
379379
): CallableFunction<T, Return extends Promise<unknown> ? Return : Promise<Return>> {

0 commit comments

Comments
 (0)