Skip to content

Commit 9b08b70

Browse files
authored
fix: createEvent type (#776)
1 parent 01e243b commit 9b08b70

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

types/__tests__/type-tests.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
createEvent,
23
fireEvent,
34
isInaccessible,
45
queries,
@@ -144,6 +145,10 @@ function eventTest() {
144145
throw new Error(`Can't find firstChild`)
145146
}
146147
fireEvent.click(element.firstChild)
148+
149+
// Custom event
150+
const customEvent = createEvent('customEvent', element)
151+
fireEvent(element, customEvent)
147152
}
148153

149154
async function testWaitFors() {

types/events.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export type FireObject = {
9494
) => boolean
9595
}
9696
export type CreateFunction = (
97-
eventName: EventType,
97+
eventName: string,
9898
node: Document | Element | Window | Node,
9999
init?: {},
100100
options?: {EventType?: string; defaultInit?: {}},
@@ -106,5 +106,5 @@ export type CreateObject = {
106106
) => Event
107107
}
108108

109-
export const createEvent: CreateObject
109+
export const createEvent: CreateObject & CreateFunction
110110
export const fireEvent: FireFunction & FireObject

0 commit comments

Comments
 (0)