Skip to content

Commit f2ebfc3

Browse files
committed
Switch return type to undefined rather than void
1 parent 3ee1248 commit f2ebfc3

File tree

7 files changed

+34
-34
lines changed

7 files changed

+34
-34
lines changed

auth/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ The `useAuthState` hook takes the following parameters:
2626

2727
Returns:
2828

29-
- `user`: The `firebase.User` if logged in, or `void` if not
29+
- `user`: The `firebase.User` if logged in, or `undefined` if not
3030
- `loading`: A `boolean` to indicate whether the the authentication state is still being loaded
31-
- `error`: Any `firebase.auth.Error` returned by Firebase when trying to load the user, or `void` if there is no error
31+
- `error`: Any `firebase.auth.Error` returned by Firebase when trying to load the user, or `undefined` if there is no error
3232

3333
#### Full Example
3434

@@ -56,7 +56,7 @@ const CurrentUser = () => {
5656
<div>
5757
<p>Error: {error}</p>
5858
</div>
59-
)
59+
);
6060
}
6161
if (user) {
6262
return (

database/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ The `useList` hook takes the following parameters:
3434

3535
Returns:
3636

37-
- `snapshots`: an array of `firebase.database.DataSnapshot`, or `void` if no reference is supplied
37+
- `snapshots`: an array of `firebase.database.DataSnapshot`, or `undefined` if no reference is supplied
3838
- `loading`: a `boolean` to indicate if the data is still being loaded
39-
- `error`: Any `firebase.FirebaseError` returned by Firebase when trying to load the data, or `void` if there is no error
39+
- `error`: Any `firebase.FirebaseError` returned by Firebase when trying to load the data, or `undefined` if there is no error
4040

4141
#### Full Example
4242

@@ -81,9 +81,9 @@ The `useListKeys` hook takes the following parameters:
8181

8282
Returns:
8383

84-
- `keys`: an array of `string`, or `void` if no reference is supplied
84+
- `keys`: an array of `string`, or `undefined` if no reference is supplied
8585
- `loading`: a `boolean` to indicate if the data is still being loaded
86-
- `error`: Any `firebase.FirebaseError` returned by Firebase when trying to load the data, or `void` if there is no error
86+
- `error`: Any `firebase.FirebaseError` returned by Firebase when trying to load the data, or `undefined` if there is no error
8787

8888
### useListVals
8989

@@ -102,9 +102,9 @@ The `useListVals` hook takes the following parameters:
102102

103103
Returns:
104104

105-
- `values`: an array of `T`, or `void` if no reference is supplied
105+
- `values`: an array of `T`, or `undefined` if no reference is supplied
106106
- `loading`: a `boolean` to indicate if the data is still being loaded
107-
- `error`: Any `firebase.FirebaseError` returned by Firebase when trying to load the data, or `void` if there is no error
107+
- `error`: Any `firebase.FirebaseError` returned by Firebase when trying to load the data, or `undefined` if there is no error
108108

109109
### useObject
110110

@@ -120,9 +120,9 @@ The `useObject` hook takes the following parameters:
120120

121121
Returns:
122122

123-
- `snapshot`: a `firebase.database.DataSnapshot`, or `void` if no reference is supplied
123+
- `snapshot`: a `firebase.database.DataSnapshot`, or `undefined` if no reference is supplied
124124
- `loading`: a `boolean` to indicate if the data is still being loaded
125-
- `error`: Any `firebase.FirebaseError` returned by Firebase when trying to load the data, or `void` if there is no error
125+
- `error`: Any `firebase.FirebaseError` returned by Firebase when trying to load the data, or `undefined` if there is no error
126126

127127
#### Full Example
128128

@@ -161,6 +161,6 @@ The `useObjectVal` hook takes the following parameters:
161161

162162
Returns:
163163

164-
- `value`: a `T`, or `void` if no reference is supplied
164+
- `value`: a `T`, or `undefined` if no reference is supplied
165165
- `loading`: a `boolean` to indicate if the data is still being loaded
166-
- `error`: Any `firebase.FirebaseError` returned by Firebase when trying to load the data, or `void` if there is no error
166+
- `error`: Any `firebase.FirebaseError` returned by Firebase when trying to load the data, or `undefined` if there is no error

database/helpers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const snapshotToData = (
88
keyField?: string
99
) => {
1010
if (!snapshot.exists) {
11-
return null;
11+
return undefined;
1212
}
1313

1414
const val = snapshot.val();

firestore/README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ The `useCollection` hook takes the following parameters:
4747

4848
Returns:
4949

50-
- `snapshot`: a `firebase.firestore.QuerySnapshot`, or `void` if no query is supplied
50+
- `snapshot`: a `firebase.firestore.QuerySnapshot`, or `undefined` if no query is supplied
5151
- `loading`: a `boolean` to indicate if the data is still being loaded
52-
- `error`: Any `Error` returned by Firebase when trying to load the data, or `void` if there is no error
52+
- `error`: Any `Error` returned by Firebase when trying to load the data, or `undefined` if there is no error
5353

5454
#### Full example
5555

@@ -100,9 +100,9 @@ The `useCollectionOnce` hook takes the following parameters:
100100

101101
Returns:
102102

103-
- `snapshot`: a `firebase.firestore.QuerySnapshot`, or `void` if no query is supplied
103+
- `snapshot`: a `firebase.firestore.QuerySnapshot`, or `undefined` if no query is supplied
104104
- `loading`: a `boolean` to indicate if the data is still being loaded
105-
- `error`: Any `Error` returned by Firebase when trying to load the data, or `void` if there is no error
105+
- `error`: Any `Error` returned by Firebase when trying to load the data, or `undefined` if there is no error
106106

107107
### useCollectionData
108108

@@ -122,9 +122,9 @@ The `useCollectionData` hook takes the following parameters:
122122

123123
Returns:
124124

125-
- `values`: an array of `T`, or `void` if no query is supplied
125+
- `values`: an array of `T`, or `undefined` if no query is supplied
126126
- `loading`: a `boolean` to indicate if the data is still being loaded
127-
- `error`: Any `Error` returned by Firebase when trying to load the data, or `void` if there is no error
127+
- `error`: Any `Error` returned by Firebase when trying to load the data, or `undefined` if there is no error
128128

129129
### useCollectionDataOnce
130130

@@ -143,9 +143,9 @@ The `useCollectionDataOnce` hook takes the following parameters:
143143

144144
Returns:
145145

146-
- `values`: an array of `T`, or `void` if no query is supplied
146+
- `values`: an array of `T`, or `undefined` if no query is supplied
147147
- `loading`: a `boolean` to indicate if the data is still being loaded
148-
- `error`: Any `Error` returned by Firebase when trying to load the data, or `void` if there is no error
148+
- `error`: Any `Error` returned by Firebase when trying to load the data, or `undefined` if there is no error
149149

150150
### useDocument
151151

@@ -163,9 +163,9 @@ The `useDocument` hook takes the following parameters:
163163

164164
Returns:
165165

166-
- `snapshot`: a `firebase.firestore.DocumentSnapshot`, or `void` if no query is supplied
166+
- `snapshot`: a `firebase.firestore.DocumentSnapshot`, or `undefined` if no query is supplied
167167
- `loading`: a `boolean` to indicate if the data is still being loaded
168-
- `error`: Any `Error` returned by Firebase when trying to load the data, or `void` if there is no error
168+
- `error`: Any `Error` returned by Firebase when trying to load the data, or `undefined` if there is no error
169169

170170
#### Full example
171171

@@ -207,9 +207,9 @@ The `useDocumentOnce` hook takes the following parameters:
207207

208208
Returns:
209209

210-
- `snapshot`: a `firebase.firestore.DocumentSnapshot`, or `void` if no reference is supplied
210+
- `snapshot`: a `firebase.firestore.DocumentSnapshot`, or `undefined` if no reference is supplied
211211
- `loading`: a `boolean` to indicate if the data is still being loaded
212-
- `error`: Any `Error` returned by Firebase when trying to load the data, or `void` if there is no error
212+
- `error`: Any `Error` returned by Firebase when trying to load the data, or `undefined` if there is no error
213213

214214
### useDocumentData
215215

@@ -229,9 +229,9 @@ The `useDocumentData` hook takes the following parameters:
229229

230230
Returns:
231231

232-
- `value`: `T`, or `void` if no query is supplied
232+
- `value`: `T`, or `undefined` if no query is supplied
233233
- `loading`: a `boolean` to indicate if the data is still being loaded
234-
- `error`: Any `Error` returned by Firebase when trying to load the data, or `void` if there is no error
234+
- `error`: Any `Error` returned by Firebase when trying to load the data, or `undefined` if there is no error
235235

236236
### useDocumentDataOnce
237237

@@ -250,6 +250,6 @@ The `useDocumentDataOnce` hook takes the following parameters:
250250

251251
Returns:
252252

253-
- `value`: `T`, or `void` if no query is supplied
253+
- `value`: `T`, or `undefined` if no query is supplied
254254
- `loading`: a `boolean` to indicate if the data is still being loaded
255-
- `error`: Any `Error` returned by Firebase when trying to load the data, or `void` if there is no error
255+
- `error`: Any `Error` returned by Firebase when trying to load the data, or `undefined` if there is no error

firestore/helpers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const snapshotToData = (
55
idField?: string
66
) => {
77
if (!snapshot.exists) {
8-
return null;
8+
return undefined;
99
}
1010

1111
return {

storage/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ The `useDownloadURL` hook takes the following parameters:
3030

3131
Returns:
3232

33-
- `downloadUrl`: A `string` download URL, or `void` if no storage reference is supplied
33+
- `downloadUrl`: A `string` download URL, or `undefined` if no storage reference is supplied
3434
- `loading`: A `boolean` to indicate whether the the download URL is still being loaded
35-
- `error`: Any `firebase.FirebaseError` returned by Firebase when trying to load the user, or `void` if there is no error
35+
- `error`: Any `firebase.FirebaseError` returned by Firebase when trying to load the user, or `undefined` if there is no error
3636

3737
#### Full example
3838

util/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export { default as useLoadingValue } from './useLoadingValue';
22
export * from './refHooks';
33

4-
export type LoadingHook<T, E> = [T | void, boolean, E | void];
4+
export type LoadingHook<T, E> = [T | undefined, boolean, E | undefined];

0 commit comments

Comments
 (0)