rtdb: Reference#transaction return type (original) (raw)

[REQUIRED] Describe your environment

[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')

const result = await getDatabase().ref('blah').transaction(data => data)

Result is any

Relevant Code:

See above.