Skip to content

Commit

Permalink
fix(database, types): harmonize on/once/off types with firebase-js-sdk
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mikehardy committed Mar 17, 2021
1 parent 8861ea4 commit b6944e4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/database/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,11 @@ export namespace FirebaseDatabaseTypes {
* @param callback The callback function that was passed to `on()` or `undefined` to remove all callbacks.
* @param context The context that was passed to `on()`.
*/
off(eventType?: EventType, callback?: () => void, context?: Record<string, any>): void;
off(
eventType?: EventType,
callback?: (a: DataSnapshot, b?: string | null) => void,
context?: Record<string, any>,
): void;

/**
* Listens for data changes at a particular location.
Expand Down Expand Up @@ -656,9 +660,9 @@ export namespace FirebaseDatabaseTypes {
on(
eventType?: EventType,
callback?: (data: DataSnapshot, previousChildKey?: string) => void,
cancelCallbackOrContext?: Record<string, any>,
cancelCallbackOrContext?: ((a: Error) => void) | Record<string, any> | null,
context?: Record<string, any> | null,
): () => void;
): (a: DataSnapshot, b?: string | null) => void;

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

0 comments on commit b6944e4

Please sign in to comment.