testing-library / vue-testing-library

🦎 Simple and complete Vue.js testing utilities that encourage good testing practices.
http://testing-library.com/vue
MIT License
1.08k stars 109 forks source link

VTL for Vue 3: Incorrect TypeScript type definitions for `emitted` #221

Closed jessevanassen closed 3 years ago

jessevanassen commented 3 years ago

In the docs for emitted, it is listed that it is an alias for the emitted function of @vue/test-utils. However, the type definition of vue-testing-library's emitted is not correct.

The emitted of vue-testing-library is typed as emitted(): EmitsOptions. However, EmitsOptions (which is imported from Vue) is not correct because that's the type used for defining which events a component can emit, not which events have been emitted.

The emitted of @vue/test-utils is typed as emitted<T = unknown>(): Record<string, T[]> (https://github.com/vuejs/vue-test-utils-next/blob/v2.0.0-rc.6/src/vueWrapper.ts#L97).

afontcu commented 3 years ago

Hi mate! Just fixed in 6.4.1. I was having some issues with tests and the pipeline so I ended up doing it by hand :) Thank you for finding this one, though! 🙌

jessevanassen commented 3 years ago

Thanks for the fix!