[types] Add TypeScript typings for firestore transactions
This commit is contained in:
parent
7f7169bd08
commit
cf24a7dcc8
|
@ -1152,7 +1152,7 @@ declare module "react-native-firebase" {
|
||||||
disableNetwork(): Promise<void>
|
disableNetwork(): Promise<void>
|
||||||
doc(documentPath: string): DocumentReference;
|
doc(documentPath: string): DocumentReference;
|
||||||
enableNetwork(): Promise<void>
|
enableNetwork(): Promise<void>
|
||||||
|
runTransaction(updateFunction: (transaction: Transaction) => Promise<any>): Promise<any>;
|
||||||
/** NOT SUPPORTED YET */
|
/** NOT SUPPORTED YET */
|
||||||
// enablePersistence(): Promise<void>;
|
// enablePersistence(): Promise<void>;
|
||||||
/** NOT SUPPORTED YET */
|
/** NOT SUPPORTED YET */
|
||||||
|
@ -1350,6 +1350,19 @@ declare module "react-native-firebase" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Transaction {
|
||||||
|
delete(docRef: DocumentReference): WriteBatch;
|
||||||
|
get(documentRef: DocumentReference): Promise<DocumentSnapshot>;
|
||||||
|
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 {
|
interface WriteBatch {
|
||||||
commit(): Promise<void>;
|
commit(): Promise<void>;
|
||||||
delete(docRef: DocumentReference): WriteBatch;
|
delete(docRef: DocumentReference): WriteBatch;
|
||||||
|
|
Loading…
Reference in New Issue