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 fbc06ca
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

1 comment on commit fbc06ca

@vercel
Copy link

@vercel vercel bot commented on fbc06ca Mar 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.