Skip to content

Commit

Permalink
Add type definitions for get() (#4096)
Browse files Browse the repository at this point in the history
* Add type definitions for get()

* cleanup

* Update .changeset/many-snails-kneel.md

Co-authored-by: Feiyang <feiyangc@google.com>

* more specific changelog

Co-authored-by: Feiyang <feiyangc@google.com>
  • Loading branch information
jmwski and Feiyang1 committed Nov 20, 2020
1 parent 3c3c5fa commit 4f63132
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-snails-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"firebase": patch
---

Add the missing type definition for 'Query.get()' for RTDB
1 change: 1 addition & 0 deletions packages/database-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export interface Query {
callback?: (a: DataSnapshot, b?: string | null) => any,
context?: Object | null
): void;
get(): Promise<DataSnapshot>;
on(
eventType: EventType,
callback: (a: DataSnapshot, b?: string | null) => any,
Expand Down
10 changes: 10 additions & 0 deletions packages/firebase/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6171,6 +6171,16 @@ declare namespace firebase.database {
context?: Object | null
): void;

/**
* Gets the most up-to-date result for this query.
*
* @return A promise which resolves to the resulting DataSnapshot if
* a value is available, or rejects if the client is unable to return
* a value (e.g., if the server is unreachable and there is nothing
* cached).
*/
get(): Promise<DataSnapshot>;

/**
* Listens for data changes at a particular location.
*
Expand Down

0 comments on commit 4f63132

Please sign in to comment.