Skip to content

Commit 0716dfa

Browse files
KazariEXantfu
andauthored
fix(watchDeep): unify overload declaration for watch functions (#4043)
Co-authored-by: Anthony Fu <[email protected]>
1 parent 5ca57d0 commit 0716dfa

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/shared/watchDeep/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import type { WatchCallback, WatchOptions, WatchSource, WatchStopHandle } from 'vue-demi'
22
import { watch } from 'vue-demi'
33

4-
import type { MapOldSources, MapSources, MultiWatchSources } from '../utils/types'
4+
import type { MapOldSources, MapSources } from '../utils/types'
55

66
// overloads
77
export function watchDeep<
8-
T extends Readonly<MultiWatchSources>,
8+
T extends Readonly<WatchSource<unknown>[]>,
99
Immediate extends Readonly<boolean> = false,
1010
>(
11-
source: T,
11+
source: [...T],
1212
cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>,
1313
options?: Omit<WatchOptions<Immediate>, 'deep'>
1414
): WatchStopHandle

packages/shared/watchImmediate/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { WatchCallback, WatchOptions, WatchSource, WatchStopHandle } from 'vue-demi'
22
import { watch } from 'vue-demi'
33

4-
import type { MapOldSources, MapSources, MultiWatchSources } from '../utils/types'
4+
import type { MapOldSources, MapSources } from '../utils/types'
55

66
// overloads
7-
export function watchImmediate<T extends Readonly<MultiWatchSources>>(
8-
source: T,
7+
export function watchImmediate<T extends Readonly<WatchSource<unknown>[]>>(
8+
source: [...T],
99
cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>,
1010
options?: Omit<WatchOptions<true>, 'immediate'>
1111
): WatchStopHandle

0 commit comments

Comments
 (0)