77 ResetOption ,
88 _DataSourceOptions ,
99 noop ,
10+ _ResolveRejectFn ,
1011} from '../shared'
1112import { ref , Ref , unref } from 'vue-demi'
1213import type {
@@ -99,9 +100,9 @@ function updateDataFromDocumentSnapshot<T>(
99100 path : string ,
100101 snapshot : DocumentSnapshot < T > ,
101102 subs : Record < string , FirestoreSubscription > ,
102- ops : CommonBindOptionsParameter [ 'ops' ] ,
103+ ops : OperationsType ,
103104 depth : number ,
104- resolve : CommonBindOptionsParameter [ 'resolve' ]
105+ resolve : _ResolveRejectFn
105106) {
106107 const [ data , refs ] = extractRefs (
107108 // @ts -expect-error: FIXME: use better types
@@ -119,7 +120,7 @@ interface SubscribeToDocumentParameter {
119120 path : string
120121 depth : number
121122 resolve : ( ) => void
122- ops : CommonBindOptionsParameter [ 'ops' ]
123+ ops : OperationsType
123124 ref : DocumentReference
124125}
125126
@@ -161,9 +162,9 @@ function subscribeToRefs(
161162 path : string | number ,
162163 subs : Record < string , FirestoreSubscription > ,
163164 refs : Record < string , DocumentReference > ,
164- ops : CommonBindOptionsParameter [ 'ops' ] ,
165+ ops : OperationsType ,
165166 depth : number ,
166- resolve : CommonBindOptionsParameter [ 'resolve' ]
167+ resolve : _ResolveRejectFn
167168) {
168169 const refKeys = Object . keys ( refs )
169170 const missingKeys = Object . keys ( subs ) . filter (
@@ -217,22 +218,12 @@ function subscribeToRefs(
217218 } )
218219}
219220
220- interface CommonBindOptionsParameter {
221- // vm: Record<string, any>
222- target : Ref < unknown >
223- // key: string
224- // Override this property in necessary functions
225- resolve : ( value : unknown ) => void
226- reject : ( error : unknown ) => void
227- ops : OperationsType
228- }
229-
230221export function bindCollection < T = unknown > (
231222 target : Ref < unknown [ ] > ,
232223 collection : CollectionReference < T > | Query < T > ,
233- ops : CommonBindOptionsParameter [ 'ops' ] ,
234- resolve : CommonBindOptionsParameter [ 'resolve' ] ,
235- reject : CommonBindOptionsParameter [ 'reject' ] ,
224+ ops : OperationsType ,
225+ resolve : _ResolveRejectFn ,
226+ reject : _ResolveRejectFn ,
236227 extraOptions ?: FirestoreRefOptions
237228) {
238229 // FIXME: can be removed now
@@ -367,10 +358,6 @@ export function bindCollection<T = unknown>(
367358 }
368359}
369360
370- interface BindDocumentParameter extends CommonBindOptionsParameter {
371- document : DocumentReference
372- }
373-
374361/**
375362 * Binds a Document to a property of vm
376363 * @param param0
@@ -379,9 +366,9 @@ interface BindDocumentParameter extends CommonBindOptionsParameter {
379366export function bindDocument < T > (
380367 target : Ref < unknown > ,
381368 document : DocumentReference < T > ,
382- ops : BindDocumentParameter [ 'ops' ] ,
383- resolve : BindDocumentParameter [ 'resolve' ] ,
384- reject : BindDocumentParameter [ 'reject' ] ,
369+ ops : OperationsType ,
370+ resolve : _ResolveRejectFn ,
371+ reject : _ResolveRejectFn ,
385372 extraOptions ?: FirestoreRefOptions
386373) {
387374 const options = Object . assign ( { } , DEFAULT_OPTIONS , extraOptions ) // fill default values
0 commit comments