From 62ec7a1ed0ceea3cc47709e753ae346818c8c653 Mon Sep 17 00:00:00 2001 From: Jan Wyszynski Date: Thu, 19 Nov 2020 15:33:45 -0800 Subject: [PATCH 1/4] Add type definitions for get() --- packages/database-types/index.d.ts | 1 + packages/firebase/index.d.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/packages/database-types/index.d.ts b/packages/database-types/index.d.ts index fa377fb241d..a59be87eb4d 100644 --- a/packages/database-types/index.d.ts +++ b/packages/database-types/index.d.ts @@ -81,6 +81,7 @@ export interface Query { callback?: (a: DataSnapshot, b?: string | null) => any, context?: Object | null ): void; + get(): Promise; on( eventType: EventType, callback: (a: DataSnapshot, b?: string | null) => any, diff --git a/packages/firebase/index.d.ts b/packages/firebase/index.d.ts index 2cae198c74d..0fed15d1242 100644 --- a/packages/firebase/index.d.ts +++ b/packages/firebase/index.d.ts @@ -6171,6 +6171,16 @@ declare namespace firebase.database { context?: Object | null ): void; + /** + * Gets the most up-to-date result for this query. + * + * @return A promse 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; + /** * Listens for data changes at a particular location. * From e168fef7d654c46d34119dd67a511d72c2927380 Mon Sep 17 00:00:00 2001 From: Jan Wyszynski Date: Thu, 19 Nov 2020 15:39:12 -0800 Subject: [PATCH 2/4] cleanup --- .changeset/many-snails-kneel.md | 6 ++++++ packages/firebase/index.d.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/many-snails-kneel.md diff --git a/.changeset/many-snails-kneel.md b/.changeset/many-snails-kneel.md new file mode 100644 index 00000000000..9f98c295baf --- /dev/null +++ b/.changeset/many-snails-kneel.md @@ -0,0 +1,6 @@ +--- +"@firebase/database": patch +"firebase": patch +--- + +Add type definitions for get() diff --git a/packages/firebase/index.d.ts b/packages/firebase/index.d.ts index 0fed15d1242..b922fcff0e5 100644 --- a/packages/firebase/index.d.ts +++ b/packages/firebase/index.d.ts @@ -6174,7 +6174,7 @@ declare namespace firebase.database { /** * Gets the most up-to-date result for this query. * - * @return A promse which resolves to the resulting DataSnapshot if + * @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). From ba7d98f4bc1c0d6d5f3d49ff0551f691d673f9b5 Mon Sep 17 00:00:00 2001 From: Jan Wyszynski Date: Thu, 19 Nov 2020 18:42:39 -0500 Subject: [PATCH 3/4] Update .changeset/many-snails-kneel.md Co-authored-by: Feiyang --- .changeset/many-snails-kneel.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.changeset/many-snails-kneel.md b/.changeset/many-snails-kneel.md index 9f98c295baf..100bf702a07 100644 --- a/.changeset/many-snails-kneel.md +++ b/.changeset/many-snails-kneel.md @@ -1,5 +1,4 @@ --- -"@firebase/database": patch "firebase": patch --- From 77500e1955e31ec21d72e3e41879dc050c99e5bd Mon Sep 17 00:00:00 2001 From: Jan Wyszynski Date: Thu, 19 Nov 2020 15:48:29 -0800 Subject: [PATCH 4/4] more specific changelog --- .changeset/many-snails-kneel.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/many-snails-kneel.md b/.changeset/many-snails-kneel.md index 100bf702a07..3755e4ce876 100644 --- a/.changeset/many-snails-kneel.md +++ b/.changeset/many-snails-kneel.md @@ -2,4 +2,4 @@ "firebase": patch --- -Add type definitions for get() +Add the missing type definition for 'Query.get()' for RTDB