From 3049c3e9b2adc69b81d72e24efc06a0cc2285b7b Mon Sep 17 00:00:00 2001 From: Edd Yerburgh Date: Sun, 19 Aug 2018 07:43:56 +0100 Subject: [PATCH] fix: improve emitted type (#933) --- packages/test-utils/types/index.d.ts | 3 ++- packages/test-utils/types/test/wrapper.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/test-utils/types/index.d.ts b/packages/test-utils/types/index.d.ts index e521aa15a..d62aa6e64 100644 --- a/packages/test-utils/types/index.d.ts +++ b/packages/test-utils/types/index.d.ts @@ -104,7 +104,8 @@ export interface Wrapper extends BaseWrapper { text (): string name (): string - emitted (event?: string): { [name: string]: Array> } + emitted (): { [name: string]: Array> } + emitted (event: string): Array emittedByOrder (): Array<{ name: string, args: Array }> } diff --git a/packages/test-utils/types/test/wrapper.ts b/packages/test-utils/types/test/wrapper.ts index c92baa9b8..816ebeeae 100644 --- a/packages/test-utils/types/test/wrapper.ts +++ b/packages/test-utils/types/test/wrapper.ts @@ -26,8 +26,8 @@ bool = wrapper.isVueInstance() wrapper.vm.$emit('hello') -const emitted = wrapper.emitted() -const arr: Array = emitted.hello +let n: number = wrapper.emitted().hello[0][0] +let o: string = wrapper.emitted('hello')[0] const emittedByOrder = wrapper.emittedByOrder() const name: string = emittedByOrder[0].name