Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#14249·Vue.js

watchEffect typing does not support async callback

Author: mitarCreated Dec 25, 2025Updated Sep 23, 2026
Labelsscope: types

Vue version

3.5.26

Link to minimal reproduction

https://github.com/vuejs/core/blob/c68bebfa6da687c2f734dac1aa2c5b51126c3ff0/packages/reactivity/src/watch.ts#L47

Steps to reproduce

Observe the type defined on OnCleanup which is used by:

bash
export type WatchEffect = (onCleanup: OnCleanup) => void

Observe that the callback cannot return a promise, so async functions are not allowed by typing.

On the other hand, current documentation does use async and even "async" behavior has an important tip at the end of this section.

What is expected?

Type like:

bash
export type WatchEffect = (onCleanup: OnCleanup) => Promise<void> | void

What is actually happening?

When type checking using eslint, it complains:

Promise returned in function argument where a void return was expected
@typescript-eslint/no-misused-promises

System Info

bash

Any additional comments?

This has been previously reported in https://github.com/vuejs/composition-api/issues/648 and based on recent comments it is still problematic.

Source: vuejs/core

View original on GitHubView discussion on GitHub