Skip to content

Commit 0d8b09f

Browse files
authored
Revert "Updated type of action parameter for DataSnapshot#forEach (#6541)"
This reverts commit 4f904bf.
1 parent 684bb4e commit 0d8b09f

File tree

7 files changed

+6
-41
lines changed

7 files changed

+6
-41
lines changed

.changeset/silly-eagles-unite.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

common/api-review/database.api.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class DataSnapshot {
3333
child(path: string): DataSnapshot;
3434
exists(): boolean;
3535
exportVal(): any;
36-
forEach(action: (child: IteratedDataSnapshot) => boolean | void): boolean;
36+
forEach(action: (child: DataSnapshot) => boolean | void): boolean;
3737
hasChild(path: string): boolean;
3838
hasChildren(): boolean;
3939
get key(): string | null;
@@ -85,12 +85,6 @@ export function goOnline(db: Database): void;
8585
// @public
8686
export function increment(delta: number): object;
8787

88-
// @public
89-
export interface IteratedDataSnapshot extends DataSnapshot {
90-
// (undocumented)
91-
key: string;
92-
}
93-
9488
// @public
9589
export function limitToFirst(limit: number): QueryConstraint;
9690

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export class DataSnapshot implements Compat<ModularDataSnapshot> {
164164
* @returns True if forEach was canceled by action returning true for
165165
* one of the child nodes.
166166
*/
167-
forEach(action: (snapshot: IteratedDataSnapshot) => boolean | void): boolean {
167+
forEach(action: (snapshot: DataSnapshot) => boolean | void): boolean {
168168
validateArgCount('DataSnapshot.forEach', 1, 1, arguments.length);
169169
validateCallback('DataSnapshot.forEach', 'action', action, false);
170170
return this._delegate.forEach(expDataSnapshot =>
@@ -208,13 +208,6 @@ export class DataSnapshot implements Compat<ModularDataSnapshot> {
208208
}
209209
}
210210

211-
/**
212-
* Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.
213-
*/
214-
export interface IteratedDataSnapshot extends DataSnapshot {
215-
key: string; // key of the location of this snapshot.
216-
}
217-
218211
export interface SnapshotCallback {
219212
(dataSnapshot: DataSnapshot, previousChildName?: string | null): unknown;
220213
}

packages/database-types/index.d.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,11 @@
1818
import { FirebaseApp } from '@firebase/app-types';
1919
import { EmulatorMockTokenOptions } from '@firebase/util';
2020

21-
/**
22-
* Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.
23-
*/
24-
export interface IteratedDataSnapshot extends DataSnapshot {
25-
key: string; // key of the location of this snapshot.
26-
}
27-
2821
export interface DataSnapshot {
2922
child(path: string): DataSnapshot;
3023
exists(): boolean;
3124
exportVal(): any;
32-
forEach(action: (a: IteratedDataSnapshot) => boolean | void): boolean;
25+
forEach(action: (a: DataSnapshot) => boolean | void): boolean;
3326
getPriority(): string | number | null;
3427
hasChild(path: string): boolean;
3528
hasChildren(): boolean;

packages/database/src/api.standalone.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export { OnDisconnect } from './api/OnDisconnect';
3737
export {
3838
DataSnapshot,
3939
EventType,
40-
IteratedDataSnapshot,
4140
QueryConstraint,
4241
QueryConstraintType,
4342
endAt,

packages/database/src/api/Reference_impl.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ export class DataSnapshot {
376376
}
377377

378378
/**
379-
* Enumerates the top-level children in the `IteratedDataSnapshot`.
379+
* Enumerates the top-level children in the `DataSnapshot`.
380380
*
381381
* Because of the way JavaScript objects work, the ordering of data in the
382382
* JavaScript object returned by `val()` is not guaranteed to match the
@@ -393,7 +393,7 @@ export class DataSnapshot {
393393
* @returns true if enumeration was canceled due to your callback returning
394394
* true.
395395
*/
396-
forEach(action: (child: IteratedDataSnapshot) => boolean | void): boolean {
396+
forEach(action: (child: DataSnapshot) => boolean | void): boolean {
397397
if (this._node.isLeafNode()) {
398398
return false;
399399
}
@@ -463,13 +463,6 @@ export class DataSnapshot {
463463
}
464464
}
465465

466-
/**
467-
* Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.
468-
*/
469-
export interface IteratedDataSnapshot extends DataSnapshot {
470-
key: string; // key of the location of this snapshot.
471-
}
472-
473466
/**
474467
*
475468
* Returns a `Reference` representing the location in the Database

packages/firebase/compat/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5819,7 +5819,7 @@ declare namespace firebase.database {
58195819
* returning true.
58205820
*/
58215821
forEach(
5822-
action: (a: firebase.database.IteratorDataSnapshot) => boolean | void
5822+
action: (a: firebase.database.DataSnapshot) => boolean | void
58235823
): boolean;
58245824
/**
58255825
* Gets the priority value of the data in this `DataSnapshot`.

0 commit comments

Comments
 (0)