@@ -54,26 +54,26 @@ type MapOldSources<T, Immediate> = {
54
54
55
55
type InvalidateCbRegistrator = ( cb : ( ) => void ) => void
56
56
57
- export interface BaseWatchOptions {
57
+ export interface WatchOptionsBase {
58
58
flush ?: 'pre' | 'post' | 'sync'
59
59
onTrack ?: ReactiveEffectOptions [ 'onTrack' ]
60
60
onTrigger ?: ReactiveEffectOptions [ 'onTrigger' ]
61
61
}
62
62
63
- export interface WatchOptions < Immediate = boolean > extends BaseWatchOptions {
63
+ export interface WatchOptions < Immediate = boolean > extends WatchOptionsBase {
64
64
immediate ?: Immediate
65
65
deep ?: boolean
66
66
}
67
67
68
- export type StopHandle = ( ) => void
68
+ export type WatchStopHandle = ( ) => void
69
69
70
70
const invoke = ( fn : Function ) => fn ( )
71
71
72
72
// Simple effect.
73
73
export function watchEffect (
74
74
effect : WatchEffect ,
75
- options ?: BaseWatchOptions
76
- ) : StopHandle {
75
+ options ?: WatchOptionsBase
76
+ ) : WatchStopHandle {
77
77
return doWatch ( effect , null , options )
78
78
}
79
79
@@ -85,7 +85,7 @@ export function watch<T, Immediate extends Readonly<boolean> = false>(
85
85
source : WatchSource < T > ,
86
86
cb : WatchCallback < T , Immediate extends true ? ( T | undefined ) : T > ,
87
87
options ?: WatchOptions < Immediate >
88
- ) : StopHandle
88
+ ) : WatchStopHandle
89
89
90
90
// overload #2: array of multiple sources + cb
91
91
// Readonly constraint helps the callback to correctly infer value types based
@@ -98,14 +98,14 @@ export function watch<
98
98
sources : T ,
99
99
cb : WatchCallback < MapSources < T > , MapOldSources < T , Immediate > > ,
100
100
options ?: WatchOptions < Immediate >
101
- ) : StopHandle
101
+ ) : WatchStopHandle
102
102
103
103
// implementation
104
104
export function watch < T = any > (
105
105
source : WatchSource < T > | WatchSource < T > [ ] ,
106
106
cb : WatchCallback < T > ,
107
107
options ?: WatchOptions
108
- ) : StopHandle {
108
+ ) : WatchStopHandle {
109
109
if ( __DEV__ && ! isFunction ( cb ) ) {
110
110
warn (
111
111
`\`watch(fn, options?)\` signature has been moved to a separate API. ` +
@@ -120,7 +120,7 @@ function doWatch(
120
120
source : WatchSource | WatchSource [ ] | WatchEffect ,
121
121
cb : WatchCallback | null ,
122
122
{ immediate, deep, flush, onTrack, onTrigger } : WatchOptions = EMPTY_OBJ
123
- ) : StopHandle {
123
+ ) : WatchStopHandle {
124
124
if ( __DEV__ && ! cb ) {
125
125
if ( immediate !== undefined ) {
126
126
warn (
@@ -274,7 +274,7 @@ export function instanceWatch(
274
274
source : string | Function ,
275
275
cb : Function ,
276
276
options ?: WatchOptions
277
- ) : StopHandle {
277
+ ) : WatchStopHandle {
278
278
const publicThis = this . proxy as any
279
279
const getter = isString ( source )
280
280
? ( ) => publicThis [ source ]
0 commit comments