Commit 9bda8f7 authored Feb 1, 2024 · 6 / 7 · Verified
1 parent e6f5d89 commit 9bda8f7 Copy full SHA for 9bda8f7
File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 1
1
- Fixes access on deeply nested, nonexistent property. (#1432 )
2
+ - Add IteratedDataSnapshot interface to match with firebase admin v12 (#1517 ).
Original file line number Diff line number Diff line change @@ -25,6 +25,14 @@ import * as database from "firebase-admin/database";
25
25
import { firebaseConfig } from "../../common/config" ;
26
26
import { joinPath , pathParts } from "../../common/utilities/path" ;
27
27
28
+ /**
29
+ * Pulled from @firebase/database-types, make sure the interface is updated on dependencies upgrades.
30
+ * Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.
31
+ */
32
+ interface IteratedDataSnapshot extends DataSnapshot {
33
+ key : string ; // key of the location of this snapshot.
34
+ }
35
+
28
36
/**
29
37
* Interface representing a Firebase Realtime database data snapshot.
30
38
*/
@@ -207,7 +215,7 @@ export class DataSnapshot implements database.DataSnapshot {
207
215
* @return `true` if enumeration was canceled due to your callback
208
216
* returning `true`.
209
217
*/
210
- forEach ( action : ( a : DataSnapshot ) => boolean | void ) : boolean {
218
+ forEach ( action : ( a : IteratedDataSnapshot ) => boolean | void ) : boolean {
211
219
const val = this . val ( ) || { } ;
212
220
if ( typeof val === "object" ) {
213
221
return Object . keys ( val ) . some ( ( key ) => action ( this . child ( key ) ) === true ) ;
You can’t perform that action at this time.
0 commit comments