Skip to content

Commit

Permalink
fix: Fix incorrect type definition for emitted
Browse files Browse the repository at this point in the history
  • Loading branch information
afontcu committed May 8, 2021
1 parent 4ace583 commit cbedda0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Minimum TypeScript Version: 4.0
/* eslint-disable @typescript-eslint/no-explicit-any */

import {EmitsOptions} from 'vue'
import {MountingOptions} from '@vue/test-utils'
import {queries, EventType, BoundFunctions} from '@testing-library/dom'
// eslint-disable-next-line import/no-extraneous-dependencies
Expand All @@ -22,7 +21,7 @@ export interface RenderResult extends BoundFunctions<typeof queries> {
debug: Debug
unmount(): void
html(): string
emitted(): EmitsOptions
emitted<T = unknown>(): Record<string, T[]>
rerender(props: object): Promise<void>
}

Expand Down
5 changes: 5 additions & 0 deletions types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ export function testOptions() {
})
}

export function testEmitted() {
const {emitted} = render(SomeComponent)
emitted().foo // $ExpectType unknown[]
}

/*
eslint
testing-library/prefer-explicit-assert: "off",
Expand Down

0 comments on commit cbedda0

Please sign in to comment.