@testing-library/user-event version: 12.3.0
Testing Framework and version: Not Relevant
Relevant code or config
https://github.com/testing-library/user-event/blob/master/typings/index.d.ts#L65
What you did:
When using user-event in typescript, I wanted to pass in clipboardData into the eventInit arg of paste, as directed by the README: https://github.com/testing-library/user-event/blob/master/README.md#pasteelement-text-eventinit-options
What happened:
I get a type error indicating that clipboardData is not found on MouseEventInit
Reproduction repository:
I'd be happy to put a repro repo, but the issue and fix seem straightforward.
Problem description:
The eventInit arg in paste is of type MouseEventInit.
Suggested solution:
The eventInit arg in paste should be type ClipboardEventInit. (https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.clipboardeventinit.html)
How did you create clipboardData? Are you using a raw JS object? JSDOM doesn't implement ClipboardData (see https://github.com/jsdom/jsdom/issues/1568).
If you need a proper value of clipboardData passed automatically when calling paste, I'm tracking support for custom implementations of ClipboardData and DataTransfer in https://github.com/testing-library/user-event/issues/355#issuecomment-642941030. If you just need the type fixed we can fix that separately.
I just need the type fixed. I'm actually using the library in a hacky fashion in the browser haha
https://github.com/dvargas92495/roam-js-extensions/blob/master/src/components/WikiData.tsx#L82
A PR correcting typings would be very much welcomed :)
@ph-fritsche - I've attempted to create a type fix PR in #611