Skip to content

Commit 6a2e490

Browse files
committed
refactor: add missing maybe ref type in useCollection()
1 parent 84c6103 commit 6a2e490

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/firestore/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export function useCollection<
176176
R extends CollectionReference<unknown> | Query<unknown>
177177
>(
178178
// TODO: add MaybeRef
179-
collectionRef: R,
179+
collectionRef: _MaybeRef<R>,
180180
options?: UseCollectionOptions
181181
): _RefFirestore<_InferReferenceType<R>[]>
182182

@@ -189,12 +189,12 @@ export function useCollection<
189189
* @param options - optional options
190190
*/
191191
export function useCollection<T>(
192-
collectionRef: CollectionReference | Query,
192+
collectionRef: _MaybeRef<CollectionReference | Query>,
193193
options?: UseCollectionOptions
194194
): _RefFirestore<VueFirestoreQueryData<T>>
195195

196196
export function useCollection<T>(
197-
collectionRef: CollectionReference<unknown> | Query<unknown>,
197+
collectionRef: _MaybeRef<CollectionReference<unknown> | Query<unknown>>,
198198
options?: UseCollectionOptions
199199
): _RefFirestore<VueFirestoreQueryData<T>> {
200200
return _useFirestoreRef(collectionRef, options) as _RefFirestore<

tests/firestore/collection.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ describe(
3737
template: 'no',
3838
setup() {
3939
// @ts-expect-error: generic forced
40-
data = useCollection(
41-
// @ts-expect-error: generic forced
42-
ref,
43-
options
44-
)
40+
data =
41+
// split for ts
42+
useCollection(ref, options)
4543
const { data: list, pending, error, promise, unbind } = data
4644
return { list, pending, error, promise, unbind }
4745
},

0 commit comments

Comments
 (0)