Closed
Description
Version
1.0.0-beta.24
Steps to reproduce
const wrapper = shallowMount(MyVueComponent);
wrapper.trigger('click'); // any event
const myEvent: string = wrapper.emitted('click')[0][0]; // Issue here!!
What is expected?
wrapper.emitted('click')[0][0];
should have signature any
.
What is actually happening?
It has signature any[]
.
The fix would be 2 method signatures:
emitted (): { [name: string]: Array<Array<any>> }
emitted (event: string): { [name: string]: Array<any> }
https://jsfiddle.net/1b68eLdr/55727/
This would make typescript happy.
Note: If you were to actually implement this signature using typescript, you can't (because of 2 methods with the same name, but different signatures). You could cast the right hand side to any
though, and it will work.