diff --git a/lib/index.d.ts b/lib/index.d.ts index c04bef1b..b89da276 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -1152,7 +1152,7 @@ declare module "react-native-firebase" { disableNetwork(): Promise doc(documentPath: string): DocumentReference; enableNetwork(): Promise - + runTransaction(updateFunction: (transaction: Transaction) => Promise): Promise; /** NOT SUPPORTED YET */ // enablePersistence(): Promise; /** NOT SUPPORTED YET */ @@ -1350,6 +1350,19 @@ declare module "react-native-firebase" { } } + interface Transaction { + delete(docRef: DocumentReference): WriteBatch; + get(documentRef: DocumentReference): Promise; + set(documentRef: DocumentReference, data: Object, options?: Types.WriteOptions): Transaction + // multiple overrides for update() to allow strong-typed var_args + update(docRef: DocumentReference, obj: object): WriteBatch; + update(docRef: DocumentReference, key1: Types.UpdateKey, val1: any): WriteBatch; + update(docRef: DocumentReference, key1: Types.UpdateKey, val1: any, key2: Types.UpdateKey, val2: any): WriteBatch; + update(docRef: DocumentReference, key1: Types.UpdateKey, val1: any, key2: Types.UpdateKey, val2: any, key3: Types.UpdateKey, val3: any): WriteBatch; + update(docRef: DocumentReference, key1: Types.UpdateKey, val1: any, key2: Types.UpdateKey, val2: any, key3: Types.UpdateKey, val3: any, key4: Types.UpdateKey, val4: any): WriteBatch; + update(docRef: DocumentReference, key1: Types.UpdateKey, val1: any, key2: Types.UpdateKey, val2: any, key3: Types.UpdateKey, val3: any, key4: Types.UpdateKey, val4: any, key5: Types.UpdateKey, val5: any): WriteBatch; + } + interface WriteBatch { commit(): Promise; delete(docRef: DocumentReference): WriteBatch;