Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/reactivity/src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export enum WatchErrorCodes {
WATCH_CLEANUP,
}

export type WatchEffect = (onCleanup: OnCleanup) => void
export type WatchEffect = (onCleanup: OnCleanup) => Promise<void> | void
Comment thread
coderabbitai[bot] marked this conversation as resolved.

export type WatchSource<T = any> = Ref<T, any> | ComputedRef<T> | (() => T)

Expand All @@ -44,7 +44,7 @@ export type WatchCallback<V = any, OV = any> = (
onCleanup: OnCleanup,
) => any

export type OnCleanup = (cleanupFn: () => void) => void
export type OnCleanup = (cleanupFn: () => void) => Promise<void> | void
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

export interface WatchOptions<Immediate = boolean> extends DebuggerOptions {
immediate?: Immediate
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime-core/__tests__/apiWatch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1104,8 +1104,8 @@ describe('api: watch', () => {
const spy = vi.fn()
watchEffect(
() => {
spy()
return arr
spy(arr)
return
},
// @ts-expect-error
{ deep: true },
Expand Down