@@ -14,6 +14,7 @@ import {
1414 noop ,
1515 OperationsType ,
1616 ResetOption ,
17+ UnbindWithReset ,
1718 walkSet ,
1819 _MaybeRef ,
1920 _RefWithState ,
@@ -46,14 +47,12 @@ export interface UseDatabaseRefOptions extends _DatabaseRefOptions {
4647 target ?: Ref < unknown >
4748}
4849
49- type UnbindType = ReturnType < typeof bindAsArray | typeof bindAsObject >
50-
5150export function _useDatabaseRef (
5251 reference : _MaybeRef < DatabaseReference | Query > ,
5352 localOptions : UseDatabaseRefOptions = { }
5453) {
5554 const options = Object . assign ( { } , rtdbOptions , localOptions )
56- let _unbind ! : UnbindType
55+ let _unbind ! : UnbindWithReset
5756
5857 const data = options . target || ref < unknown | null > ( options . initialValue )
5958 const error = ref < Error > ( )
@@ -112,7 +111,7 @@ export function _useDatabaseRef(
112111 // should take an option like once: true to not setting up any listener
113112 }
114113
115- let stopWatcher : ReturnType < typeof watch > = noop
114+ let stopWatcher = noop
116115 if ( isRef ( reference ) ) {
117116 stopWatcher = watch ( reference , bindDatabaseRef , { immediate : true } )
118117 } else {
@@ -142,7 +141,7 @@ export function _useDatabaseRef(
142141
143142export function internalUnbind (
144143 key : string ,
145- unbinds : Record < string , UnbindType > | undefined ,
144+ unbinds : Record < string , UnbindWithReset > | undefined ,
146145 reset ?: ResetOption
147146) {
148147 if ( unbinds && unbinds [ key ] ) {
@@ -185,5 +184,5 @@ export function useObject<T = unknown>(
185184 } ) as _RefDatabase < VueDatabaseDocumentData < T > | undefined >
186185}
187186
188- export const unbind = ( target : Ref , reset ?: _DatabaseRefOptions [ 'reset' ] ) =>
187+ export const unbind = ( target : Ref , reset ?: ResetOption ) =>
189188 internalUnbind ( '' , rtdbUnbinds . get ( target ) , reset )
0 commit comments