File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 11- 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";
2525import { firebaseConfig } from "../../common/config" ;
2626import { joinPath , pathParts } from "../../common/utilities/path" ;
2727
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+
2836/**
2937 * Interface representing a Firebase Realtime database data snapshot.
3038 */
@@ -207,7 +215,7 @@ export class DataSnapshot implements database.DataSnapshot {
207215 * @return `true` if enumeration was canceled due to your callback
208216 * returning `true`.
209217 */
210- forEach ( action : ( a : DataSnapshot ) => boolean | void ) : boolean {
218+ forEach ( action : ( a : IteratedDataSnapshot ) => boolean | void ) : boolean {
211219 const val = this . val ( ) || { } ;
212220 if ( typeof val === "object" ) {
213221 return Object . keys ( val ) . some ( ( key ) => action ( this . child ( key ) ) === true ) ;
You can’t perform that action at this time.
0 commit comments