Native event listener types should allow a promise return type
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- developer-experience, frontend
Research direction
Start with EventHandlers in packages/runtime-dom/src/jsx.ts and the minimal reproduction linked in the issue. Check how the listener type interacts with async handlers and @typescript-eslint/no-misused-promises, then run the reproduction’s lint command. Done when an async native listener no longer triggers the lint error and Vue’s promise rejection handling remains available.
Written by the indexing model from the issue text.
Description
Vue version
3.5.45 (main at 0f4002c has the same types)
Link to minimal reproduction
https://github.com/magurotuna/vue-async-native-listener-no-misused-promises-repro
Steps to reproduce
npm installnpx eslint .
What is expected?
No lint error from no-misused-promises for <button onClick={load}>, where load is an async function.
Vue catches a promise that a native listener returns and sends a rejection to app.config.errorHandler (events.ts, errorHandling.ts, and the docs).
What is actually happening?
@typescript-eslint/no-misused-promises reports
/Users/yt/tmp/vue-async-native-listener-no-misused-promises-repro/src/App.tsx
13:32 error Promise-returning function provided to attribute where a void return was expected @typescript-eslint/no-misused-promises
✖ 1 problem (1 error, 0 warnings)
because EventHandlers types the listener as (payload: MouseEvent) => void. tsc gives no error. Tools that type-check templates give the same report for <button @click="load">.
System Info
System:
OS: macOS 26.7.1
CPU: (12) arm64 Apple M3 Pro
Memory: 121.02 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.21.0 - /Users/yt/.nix-profile/bin/node
npm: 11.19.0 - /Users/yt/.nix-profile/bin/npm
pnpm: 12.9.0 - /Users/yt/.nix-profile/bin/pnpm
bun: 1.4.2 - /Users/yt/.nix-profile/bin/bun
Deno: 2.9.7 - /Users/yt/.nix-profile/bin/deno
Watchman: 2026.07.27.00 - /Users/yt/.nix-profile/bin/watchman
Browsers:
Chrome: 157.0.8103.79
Firefox: 159.0
Safari: 26.6.2
npmPackages:
vue: 3.5.45 => 3.5.45
Any additional comments?
The usual fix for this report is onClick={() => void load()}, but then a rejection is unhandled and does not reach app.config.errorHandler, which is worse.
typescript-eslint accepts a union with a promise-returning member typescript-eslint/typescript-eslint#4841, so the following change would be an option to solve this issue:
type EventHandlers<E> = {
[K in keyof E]?: E[K] extends (...args: any) => any
? E[K]
: ((payload: E[K]) => void) | ((payload: E[K]) => Promise<unknown>)
}
This type well declares the fact that the handler's return value is actually used by Vue to catch errors, if it is a promise.
I tried this change on 43 open-source Vue projects, and it added no type errors.
Related: #14249 (the same lint error for watchEffect).
- Dominant language
- TypeScript
- Stars
- 55k
- Forks
- 9.3k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 194
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vuejs/core
-
watchEffect typing does not support async callbackPossibly taken @zhanghaifeng213 claimed this 327 days ago. Openscope: types
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vuejs/core#14249 · 4 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
[@vue/reactivity] watch() doesn't accept TS genericsPossibly taken @alex-snezhko claimed this 442 days ago. Openscope: types
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
vuejs/core#13807 · 3 reactions ·
Maintainers usually reply within 1 day
-
Invalid HTML with `TransitionGroup name="list" tag="ul"`Possibly taken @ZKunZhang claimed this 428 days ago. Open🔩 p2-edge-case scope: ssr
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
vuejs/core#13037 · 8 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 1-2 days Newbie friendliness 50/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 46/100
Maintainers usually reply within 1 day
Similar issues
-
bug priority: low role: BE stage: now
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
ahmadrosid/nakama#2594 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
milind-soni/OpenMausBot#6495 ·
Maintainers usually reply within 1 day
-
Navigating the session tree adds the branch's prompts to Up-arrow history againPossibly taken @acmerfight claimed this today. Openuntriaged
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
earendil-works/pi#12279 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
approved documentation
Difficulty 1/5 Under an hour Newbie friendliness 89/100
vitest-dev/vitest#12015 · 4 comments ·
Maintainers usually reply within 1 day