Skip to content

Commit 9538a77

Browse files
committed
Added non-null parent property to IteratedDataSnapshot
1 parent b92592d commit 9538a77

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

packages/database-compat/src/api/Reference.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,12 @@ export class DataSnapshot implements Compat<ModularDataSnapshot> {
209209
}
210210

211211
/**
212-
* Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.
212+
* Represents a child snapshot of a `Reference` that is being iterated over. The
213+
* key and parent will never be undefined.
213214
*/
214215
export interface IteratedDataSnapshot extends DataSnapshot {
215216
key: string; // key of the location of this snapshot.
217+
parent: Reference;
216218
}
217219

218220
export interface SnapshotCallback {

packages/database-types/index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ import { FirebaseApp } from '@firebase/app-types';
1919
import { EmulatorMockTokenOptions } from '@firebase/util';
2020

2121
/**
22-
* Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.
22+
* Represents a child snapshot of a `Reference` that is being iterated over. The
23+
* key and parent will never be undefined.
2324
*/
2425
export interface IteratedDataSnapshot extends DataSnapshot {
2526
key: string; // key of the location of this snapshot.
27+
parent: Reference;
2628
}
2729

2830
export interface DataSnapshot {

packages/database/src/api/Reference_impl.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,12 @@ export class DataSnapshot {
464464
}
465465

466466
/**
467-
* Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.
467+
* Represents a child snapshot of a `Reference` that is being iterated over. The
468+
* key and parent will never be undefined.
468469
*/
469470
export interface IteratedDataSnapshot extends DataSnapshot {
470471
key: string; // key of the location of this snapshot.
472+
parent: DatabaseReference;
471473
}
472474

473475
/**

packages/firebase/compat/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6001,6 +6001,7 @@ declare namespace firebase.database {
60016001

60026002
interface IteratedDataSnapshot extends DataSnapshot {
60036003
key: string; // key of the location of this snapshot.
6004+
parent: Reference;
60046005
}
60056006

60066007
/**

0 commit comments

Comments
 (0)