Skip to content

Commit

Permalink
fix(watchDeep,watchImmediate): fix callback function execution logic (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfred-Skyblue committed Apr 11, 2023
1 parent b574c26 commit e6e2576
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 2 additions & 5 deletions packages/shared/watchDeep/index.ts
Expand Up @@ -6,13 +6,10 @@ import { watch } from 'vue-demi'
*
* @see https://vueuse.org/watchDeep
*/
export function watchDeep<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions) {
export function watchDeep<T>(source: WatchSource<T>, cb: WatchCallback<T>, options?: Omit<WatchOptions, 'deep'>) {
return watch(
source,
(v, ov, onInvalidate) => {
if (v)
cb(v, ov, onInvalidate)
},
cb,
{
...options,
deep: true,
Expand Down
7 changes: 2 additions & 5 deletions packages/shared/watchImmediate/index.ts
Expand Up @@ -6,13 +6,10 @@ import { watch } from 'vue-demi'
*
* @see https://vueuse.org/watchImmediate
*/
export function watchImmediate<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions) {
export function watchImmediate<T>(source: WatchSource<T>, cb: WatchCallback<T>, options?: Omit<WatchOptions, 'immediate'>) {
return watch(
source,
(v, ov, onInvalidate) => {
if (v)
cb(v, ov, onInvalidate)
},
cb,
{
...options,
immediate: true,
Expand Down

0 comments on commit e6e2576

Please sign in to comment.