Closed
Description
Describe the bug
vue@3.4.22
added stricter type checking for event handlers, enforcing that they're either a Function
or Function[]
, and not a string
.
@vue/test-utils
actively sets handlers to the string
"[Function]"
, resulting in a warning:
Error: Wrong type passed as event handler to onLeave - did you forget @ or : in front of your prop?
Expected function or array of functions, received type string.at <Transition>
To Reproduce
https://stackblitz.com/edit/github-tyybbg?file=src%2Fcomponents%2FWelcomeItem.vue
npm i && npm run test:unit
Expected behavior
No warnings.
Related information:
System:
OS: macOS 14.4.1
CPU: (10) arm64 Apple M1 Pro
Memory: 1.61 GB / 16.00 GB
Shell: 5.9 - /bin/zsh
npmPackages:
@vue/test-utils: ^2.4.5 => 2.4.5
vue: ^3.4.22 => 3.4.22
Additional context