|
1 |
| -import React from 'react' |
| 1 | +import * as React from 'react' |
2 | 2 | import * as FirestoreTypes from '@firebase/firestore-types'
|
3 | 3 | import * as DatabaseTypes from '@firebase/database-types'
|
4 | 4 | import * as StorageTypes from '@firebase/storage-types'
|
5 | 5 | import * as AuthTypes from '@firebase/auth-types'
|
6 |
| -import * as AppTypes from '@firebase/app-types' |
7 | 6 | import { Dispatch } from 'redux'
|
8 | 7 |
|
9 | 8 | /**
|
@@ -451,40 +450,43 @@ interface ExtendedFirestoreInstance extends FirestoreTypes.FirebaseFirestore {
|
451 | 450 | * Get data from firestore.
|
452 | 451 | * @see https://github.com/prescottprue/redux-firestore#get
|
453 | 452 | */
|
454 |
| - get: (docPath: string | ReduxFirestoreQuerySetting) => Promise<void> |
| 453 | + get: <T>( |
| 454 | + docPath: string | ReduxFirestoreQuerySetting |
| 455 | + ) => Promise<FirestoreTypes.DocumentSnapshot<Partial<T>>> |
455 | 456 |
|
456 | 457 | /**
|
457 | 458 | * Set data to firestore.
|
458 | 459 | * @see https://github.com/prescottprue/redux-firestore#set
|
459 | 460 | */
|
460 |
| - set: ( |
| 461 | + set: <T>( |
461 | 462 | docPath: string | ReduxFirestoreQuerySetting,
|
462 |
| - data: Object |
463 |
| - ) => Promise<void> |
| 463 | + data: Partial<T>, |
| 464 | + options?: FirestoreTypes.SetOptions |
| 465 | + ) => Promise<FirestoreTypes.DocumentSnapshot<Partial<T>>> |
464 | 466 |
|
465 | 467 | /**
|
466 | 468 | * Add document to firestore.
|
467 | 469 | * @see https://github.com/prescottprue/redux-firestore#add
|
468 | 470 | */
|
469 |
| - add: ( |
| 471 | + add: <T>( |
470 | 472 | collectionPath: string | ReduxFirestoreQuerySetting,
|
471 |
| - data: Object |
| 473 | + data: Partial<T> |
472 | 474 | ) => Promise<{ id: string }>
|
473 | 475 |
|
474 | 476 | /**
|
475 | 477 | * Update document within firestore.
|
476 | 478 | * @see https://github.com/prescottprue/redux-firestore#update
|
477 | 479 | */
|
478 |
| - update: ( |
| 480 | + update: <T>( |
479 | 481 | docPath: string | ReduxFirestoreQuerySetting,
|
480 |
| - data: Object |
481 |
| - ) => Promise<void> |
| 482 | + data: Partial<T> |
| 483 | + ) => Promise<FirestoreTypes.DocumentSnapshot<Partial<T>>> |
482 | 484 |
|
483 | 485 | /**
|
484 | 486 | * Delete a document within firestore.
|
485 | 487 | * @see https://github.com/prescottprue/redux-firestore#delete
|
486 | 488 | */
|
487 |
| - delete: (docPath: string | ReduxFirestoreQuerySetting) => Promise<void> |
| 489 | + delete: <T>(docPath: string | ReduxFirestoreQuerySetting) => Promise<T> |
488 | 490 |
|
489 | 491 | /**
|
490 | 492 | * Executes the given updateFunction and then attempts to commit the changes applied within the
|
|
0 commit comments