@@ -21,13 +21,13 @@ import { filterNoneValueObject, createParams, syncQuery2Conditions, isEquivalent
2121import { containsProp , isNoData as isDataEmpty , isObject , isServer , rAF } from './utils/helper'
2222
2323export default function useConditionWatcher <
24- Result extends unknown ,
2524 Cond extends Record < string , any > ,
26- AfterResult extends unknown = Result
25+ Result extends unknown ,
26+ AfterFetchResult extends unknown = Result
2727> (
28- config : Config < Result , Cond , AfterResult >
29- ) : UseConditionWatcherReturn < AfterResult extends Result ? Result : AfterResult , Cond > {
30- function isFetchConfig ( obj : object ) : obj is typeof config {
28+ config : Config < Cond , Result , AfterFetchResult >
29+ ) : UseConditionWatcherReturn < Cond , AfterFetchResult extends Result ? Result : AfterFetchResult > {
30+ function isFetchConfig ( obj : Record < string , any > ) : obj is typeof config {
3131 return containsProp (
3232 obj ,
3333 'fetcher' ,
@@ -103,7 +103,7 @@ export default function useConditionWatcher<
103103 stopVisibilityEvent,
104104 } = createEvents ( )
105105
106- const resetConditions = ( cond ?: object ) : void => {
106+ const resetConditions = ( cond ?: Record < string , any > ) : void => {
107107 Object . assign ( _conditions , isObject ( cond ) && ! cond . type ? cond : backupIntiConditions )
108108 }
109109
@@ -115,7 +115,7 @@ export default function useConditionWatcher<
115115 isFetching . value = true
116116 error . value = undefined
117117 const conditions2Object : Conditions < Cond > = conditions
118- let customConditions : object = { }
118+ let customConditions : Record < string , any > = { }
119119 const deepCopyCondition : Conditions < Cond > = deepClone ( conditions2Object )
120120
121121 if ( typeof watcherConfig . beforeFetch === 'function' ) {
@@ -144,7 +144,7 @@ export default function useConditionWatcher<
144144 * return result will be {age: 0}
145145 */
146146 query . value = filterNoneValueObject ( validateCustomConditions ? customConditions : conditions2Object )
147- const finalConditions : object = createParams ( query . value , watcherConfig . defaultParams )
147+ const finalConditions : Record < string , any > = createParams ( query . value , watcherConfig . defaultParams )
148148
149149 let responseData : any = undefined
150150
@@ -276,7 +276,7 @@ export default function useConditionWatcher<
276276 sync : config . history . sync ,
277277 ignore : config . history . ignore || [ ] ,
278278 navigation : config . history . navigation || 'push' ,
279- listener ( parsedQuery : object ) {
279+ listener ( parsedQuery : Record < string , any > ) {
280280 const queryObject = Object . keys ( parsedQuery ) . length ? parsedQuery : backupIntiConditions
281281 syncQuery2Conditions ( _conditions , queryObject , backupIntiConditions )
282282 } ,
0 commit comments