Skip to content

Commit fbc06ca

Browse files
committed
fix(database, types): harmonize on/once/off types with firebase-js-sdk
This does not change the underlying implementation which should still be correct with the updated types, it only copies in the type definitions from firebase-js-sdk so we stay in sync with them Related #5027 - the type-related part of that issue
1 parent 8861ea4 commit fbc06ca

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/database/lib/index.d.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,11 @@ export namespace FirebaseDatabaseTypes {
599599
* @param callback The callback function that was passed to `on()` or `undefined` to remove all callbacks.
600600
* @param context The context that was passed to `on()`.
601601
*/
602-
off(eventType?: EventType, callback?: () => void, context?: Record<string, any>): void;
602+
off(
603+
eventType?: EventType,
604+
callback?: (a: DataSnapshot, b?: string | null) => void,
605+
context?: Record<string, any>,
606+
): void;
603607

604608
/**
605609
* Listens for data changes at a particular location.
@@ -656,9 +660,9 @@ export namespace FirebaseDatabaseTypes {
656660
on(
657661
eventType?: EventType,
658662
callback?: (data: DataSnapshot, previousChildKey?: string) => void,
659-
cancelCallbackOrContext?: Record<string, any>,
663+
cancelCallbackOrContext?: ((a: Error) => void) | Record<string, any> | null,
660664
context?: Record<string, any> | null,
661-
): () => void;
665+
): (a: DataSnapshot, b?: string | null) => void;
662666

663667
/**
664668
* Listens for exactly one event of the specified event type, and then stops listening.

0 commit comments

Comments
 (0)