Skip to content

Add type definitions for get() #4096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/many-snails-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@firebase/database": patch
"firebase": patch
---

Add type definitions for get()
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