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" 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`.