From 1205b3e38456ab5cbb577d6db098c8a303b44a00 Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Mon, 15 Aug 2022 21:36:27 -0700 Subject: [PATCH 1/2] Revert "Updated type of action parameter for DataSnapshot#forEach (#6374)" This reverts commit 65838089da47965e5e39e58c76a81a74666b215e. --- common/api-review/database.api.md | 4 +--- packages/database-compat/src/api/Reference.ts | 4 +--- packages/database-types/index.d.ts | 4 +--- packages/database/src/api/Reference_impl.ts | 4 +--- packages/firebase/compat/index.d.ts | 4 +--- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/common/api-review/database.api.md b/common/api-review/database.api.md index 5ce1fbeaf80..8b3ef1ac7fb 100644 --- a/common/api-review/database.api.md +++ b/common/api-review/database.api.md @@ -33,9 +33,7 @@ export class DataSnapshot { child(path: string): DataSnapshot; exists(): boolean; exportVal(): any; - forEach(action: (child: DataSnapshot & { - key: string; - }) => boolean | void): boolean; + forEach(action: (child: DataSnapshot) => boolean | void): boolean; hasChild(path: string): boolean; hasChildren(): boolean; get key(): string | null; diff --git a/packages/database-compat/src/api/Reference.ts b/packages/database-compat/src/api/Reference.ts index e2bbef4ef26..3f9bb63b8ff 100644 --- a/packages/database-compat/src/api/Reference.ts +++ b/packages/database-compat/src/api/Reference.ts @@ -164,9 +164,7 @@ export class DataSnapshot implements Compat { * @returns True if forEach was canceled by action returning true for * one of the child nodes. */ - forEach( - action: (snapshot: DataSnapshot & { key: string }) => boolean | void - ): boolean { + forEach(action: (snapshot: DataSnapshot) => boolean | void): boolean { validateArgCount('DataSnapshot.forEach', 1, 1, arguments.length); validateCallback('DataSnapshot.forEach', 'action', action, false); return this._delegate.forEach(expDataSnapshot => diff --git a/packages/database-types/index.d.ts b/packages/database-types/index.d.ts index 55d3d236f96..680a4a540b8 100644 --- a/packages/database-types/index.d.ts +++ b/packages/database-types/index.d.ts @@ -22,9 +22,7 @@ export interface DataSnapshot { child(path: string): DataSnapshot; exists(): boolean; exportVal(): any; - forEach( - action: (a: DataSnapshot & { key: string }) => boolean | void - ): boolean; + forEach(action: (a: DataSnapshot) => boolean | void): boolean; getPriority(): string | number | null; hasChild(path: string): boolean; hasChildren(): boolean; diff --git a/packages/database/src/api/Reference_impl.ts b/packages/database/src/api/Reference_impl.ts index 97e20ef635d..ef98380d0d1 100644 --- a/packages/database/src/api/Reference_impl.ts +++ b/packages/database/src/api/Reference_impl.ts @@ -393,9 +393,7 @@ export class DataSnapshot { * @returns true if enumeration was canceled due to your callback returning * true. */ - forEach( - action: (child: DataSnapshot & { key: string }) => boolean | void - ): boolean { + forEach(action: (child: DataSnapshot) => boolean | void): boolean { if (this._node.isLeafNode()) { return false; } diff --git a/packages/firebase/compat/index.d.ts b/packages/firebase/compat/index.d.ts index a946c38ec9a..ece18a5d1dd 100644 --- a/packages/firebase/compat/index.d.ts +++ b/packages/firebase/compat/index.d.ts @@ -5819,9 +5819,7 @@ declare namespace firebase.database { * returning true. */ forEach( - action: ( - a: firebase.database.DataSnapshot & { key: string } - ) => boolean | void + action: (a: firebase.database.DataSnapshot) => boolean | void ): boolean; /** * Gets the priority value of the data in this `DataSnapshot`. From 5d056c6944cf9b91feeea976ce1c9902431862ab Mon Sep 17 00:00:00 2001 From: Maneesh Tewani Date: Mon, 15 Aug 2022 21:37:07 -0700 Subject: [PATCH 2/2] Create orange-doors-swim.md --- .changeset/orange-doors-swim.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/orange-doors-swim.md diff --git a/.changeset/orange-doors-swim.md b/.changeset/orange-doors-swim.md new file mode 100644 index 00000000000..4b20eb3f200 --- /dev/null +++ b/.changeset/orange-doors-swim.md @@ -0,0 +1,7 @@ +--- +"@firebase/database-compat": patch +"@firebase/database-types": patch +"@firebase/database": patch +--- + +Revert "Updated type of action parameter for DataSnapshot#forEach"