Skip to content

Commit 8974b1c

Browse files
committed
Add flow types for useCollectionData and useDocumentData
1 parent 3583e2b commit 8974b1c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

firestore/index.js.flow

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,35 @@ export type CollectionHook = {
1212
loading: boolean,
1313
value?: QuerySnapshot,
1414
};
15+
export type CollectionDataHook<T> = {
16+
error?: Object,
17+
loading: boolean,
18+
value?: T,
19+
};
1520
export type DocumentHook = {
1621
error?: Object,
1722
loading: boolean,
1823
value?: DocumentSnapshot,
1924
};
25+
export type DocumentDataHook<T> = {
26+
error?: Object,
27+
loading: boolean,
28+
value?: T,
29+
};
2030

2131
declare export function useCollection(
2232
query?: Query | null,
2333
options?: SnapshotListenOptions
2434
): CollectionHook;
35+
declare export function useCollectionData(
36+
query?: Query | null,
37+
idField?: string
38+
): CollectionDataHook;
2539
declare export function useDocument(
2640
ref?: DocumentReference | null,
2741
options?: SnapshotListenOptions
2842
): DocumentHook;
43+
declare export function useDocumentData(
44+
ref?: DocumentReference | null,
45+
idField?: string
46+
): DocumentHook;

0 commit comments

Comments
 (0)