Skip to content

Commit 9f1e3c6

Browse files
authored
Revert "Updated type of action parameter for DataSnapshot#forEach" (#6536)
* Revert "Updated type of action parameter for DataSnapshot#forEach (#6374)" This reverts commit 6583808.
1 parent b6c231a commit 9f1e3c6

File tree

6 files changed

+12
-15
lines changed

6 files changed

+12
-15
lines changed

.changeset/orange-doors-swim.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@firebase/database-compat": patch
3+
"@firebase/database-types": patch
4+
"@firebase/database": patch
5+
---
6+
7+
Revert "Updated type of action parameter for DataSnapshot#forEach"

common/api-review/database.api.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ export class DataSnapshot {
3333
child(path: string): DataSnapshot;
3434
exists(): boolean;
3535
exportVal(): any;
36-
forEach(action: (child: DataSnapshot & {
37-
key: string;
38-
}) => boolean | void): boolean;
36+
forEach(action: (child: DataSnapshot) => boolean | void): boolean;
3937
hasChild(path: string): boolean;
4038
hasChildren(): boolean;
4139
get key(): string | null;

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -164,9 +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(
168-
action: (snapshot: DataSnapshot & { key: string }) => boolean | void
169-
): boolean {
167+
forEach(action: (snapshot: DataSnapshot) => boolean | void): boolean {
170168
validateArgCount('DataSnapshot.forEach', 1, 1, arguments.length);
171169
validateCallback('DataSnapshot.forEach', 'action', action, false);
172170
return this._delegate.forEach(expDataSnapshot =>

packages/database-types/index.d.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ export interface DataSnapshot {
2222
child(path: string): DataSnapshot;
2323
exists(): boolean;
2424
exportVal(): any;
25-
forEach(
26-
action: (a: DataSnapshot & { key: string }) => boolean | void
27-
): boolean;
25+
forEach(action: (a: DataSnapshot) => boolean | void): boolean;
2826
getPriority(): string | number | null;
2927
hasChild(path: string): boolean;
3028
hasChildren(): boolean;

packages/database/src/api/Reference_impl.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,7 @@ export class DataSnapshot {
393393
* @returns true if enumeration was canceled due to your callback returning
394394
* true.
395395
*/
396-
forEach(
397-
action: (child: DataSnapshot & { key: string }) => boolean | void
398-
): boolean {
396+
forEach(action: (child: DataSnapshot) => boolean | void): boolean {
399397
if (this._node.isLeafNode()) {
400398
return false;
401399
}

packages/firebase/compat/index.d.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -5819,9 +5819,7 @@ declare namespace firebase.database {
58195819
* returning true.
58205820
*/
58215821
forEach(
5822-
action: (
5823-
a: firebase.database.DataSnapshot & { key: string }
5824-
) => boolean | void
5822+
action: (a: firebase.database.DataSnapshot) => boolean | void
58255823
): boolean;
58265824
/**
58275825
* Gets the priority value of the data in this `DataSnapshot`.

0 commit comments

Comments
 (0)