Skip to content

Commit 354bc91

Browse files
committed
Update flow types following #10
1 parent 01e8616 commit 354bc91

File tree

4 files changed

+45
-35
lines changed

4 files changed

+45
-35
lines changed

auth/index.js.flow

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// @flow
2-
import type { Auth, User } from 'firebase';
2+
import type { FirebaseUser as User } from 'firebase';
3+
import type { Auth } from 'firebase/auth';
34
export type AuthStateHook = {
4-
user?: User;
5-
initialising: boolean;
5+
user?: User,
6+
initialising: boolean,
67
};
78
declare export function useAuthState(auth: Auth): AuthStateHook;

database/index.js.flow

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,36 @@
22
import type { DataSnapshot, Query } from 'firebase/database';
33

44
export type ListHook = {
5-
error?: Object;
6-
loading: boolean;
7-
value: DataSnapshot[];
5+
error?: Object,
6+
loading: boolean,
7+
value: DataSnapshot[],
88
};
99
export type ListKeysHook = {
10-
error?: Object;
11-
loading: boolean;
12-
value: string[];
10+
error?: Object,
11+
loading: boolean,
12+
value: string[],
1313
};
1414
export type ListValsHook<T> = {
15-
error?: Object;
16-
loading: boolean;
17-
value: T[];
15+
error?: Object,
16+
loading: boolean,
17+
value: T[],
1818
};
1919
export type ObjectHook = {
20-
error?: Object;
21-
loading: boolean;
22-
value?: DataSnapshot;
20+
error?: Object,
21+
loading: boolean,
22+
value?: DataSnapshot,
2323
};
2424
export type ObjectValHook<T> = {
25-
error?: Object;
26-
loading: boolean;
27-
value?: T;
25+
error?: Object,
26+
loading: boolean,
27+
value?: T,
2828
};
2929

30-
declare export function useList(query: Query): ListHook;
31-
declare export function useListKeys(query: Query): ListKeysHook;
32-
declare export function useListVals<T>(query: Query, keyField?: string): ListValsHook<T>;
33-
declare export function useObject(query: Query): ObjectHook;
34-
declare export function useObjectVal<T>(query: Query): ObjectValHook<T>;
30+
declare export function useList(query?: Query | null): ListHook;
31+
declare export function useListKeys(query?: Query | null): ListKeysHook;
32+
declare export function useListVals<T>(
33+
query?: Query | null,
34+
keyField?: string
35+
): ListValsHook<T>;
36+
declare export function useObject(query?: Query | null): ObjectHook;
37+
declare export function useObjectVal<T>(query?: Query | null): ObjectValHook<T>;

firestore/index.js.flow

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,21 @@ import type {
88
} from 'firebase/firestore';
99

1010
export type CollectionHook = {
11-
error?: Object;
12-
loading: boolean;
13-
value?: firestore.QuerySnapshot;
11+
error?: Object,
12+
loading: boolean,
13+
value?: firestore.QuerySnapshot,
1414
};
1515
export type DocumentHook = {
16-
error?: Object;
17-
loading: boolean;
18-
value?: firestore.DocumentSnapshot;
16+
error?: Object,
17+
loading: boolean,
18+
value?: firestore.DocumentSnapshot,
1919
};
2020

21-
declare export function useCollection(query: Query, options?: SnapshotListenOptions): CollectionHook;
22-
declare export function useDocument(ref: firestore.DocumentReference, options?: SnapshotListenOptions): DocumentHook;
21+
declare export function useCollection(
22+
query?: Query | null,
23+
options?: SnapshotListenOptions
24+
): CollectionHook;
25+
declare export function useDocument(
26+
ref?: DocumentReference | null,
27+
options?: SnapshotListenOptions
28+
): DocumentHook;

storage/index.js.flow

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import type { Reference } from 'firebase/storage';
33

44
export type DownloadURLHook = {
5-
error?: Object;
6-
loading: boolean;
7-
value?: string;
5+
error?: Object,
6+
loading: boolean,
7+
value?: string,
88
};
9-
declare export function useDownloadURL(ref: Reference): DownloadURLHook;
9+
declare export function useDownloadURL(ref?: Reference | null): DownloadURLHook;

0 commit comments

Comments
 (0)