Skip to content

rtdb: Reference#transaction return type #6071

Closed
@rhodgkins

Description

@rhodgkins

[REQUIRED] Describe your environment

  • Operating System version: macOS
  • Browser version: N/A
  • Firebase SDK version: firebase-admin@10
  • Firebase Product: database

[REQUIRED] Describe the problem

The transaction method on a reference is typed to return Promise<any> as opposed to Promise<{ committed: boolean, snapshot: DataSnapshot }>.

transaction(
transactionUpdate: (a: any)=>any,
onComplete?: (a: Error|null,b: boolean,c: DataSnapshot|null)=>any,
applyLocally?: boolean
): Promise<any>;

This is the same problem in the docs.

I'm happy to create a PR to update the above file, but not sure if that's the correct place to do this?

Steps to reproduce:

const{ getDatabase }=require('firebase-admin/database')constresult=awaitgetDatabase().ref('blah').transaction(data=>data)

Result is any

Relevant Code:

See above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      close