Vue version
3.5.26
Link to minimal reproduction
|
export type OnCleanup = (cleanupFn: () => void) => void |
Steps to reproduce
Observe the type defined on OnCleanup which is used by:
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:
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
Any additional comments?
This has been previously reported in vuejs/composition-api#648 and based on recent comments it is still problematic.
Vue version
3.5.26
Link to minimal reproduction
core/packages/reactivity/src/watch.ts
Line 47 in c68bebf
Steps to reproduce
Observe the type defined on
OnCleanupwhich is used by: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:
What is actually happening?
When type checking using eslint, it complains:
System Info
Any additional comments?
This has been previously reported in vuejs/composition-api#648 and based on recent comments it is still problematic.