Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paste eventInit Type should be ClipboardEventInit #512

Closed
dvargas92495 opened this issue Dec 2, 2020 · 4 comments · Fixed by #611
Closed

Paste eventInit Type should be ClipboardEventInit #512

dvargas92495 opened this issue Dec 2, 2020 · 4 comments · Fixed by #611
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@dvargas92495
Copy link

  • @testing-library/user-event version: 12.3.0

  • Testing Framework and version: Not Relevant

  • DOM Environment: 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)

@nickmccurdy
Copy link
Member

nickmccurdy commented Dec 22, 2020

How did you create clipboardData? Are you using a raw JS object? JSDOM doesn't implement ClipboardData (see jsdom/jsdom#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 #355 (comment). If you just need the type fixed we can fix that separately.

@dvargas92495
Copy link
Author

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

@ph-fritsche
Copy link
Member

ph-fritsche commented Mar 16, 2021

A PR correcting typings would be very much welcomed :)

@ph-fritsche ph-fritsche added bug Something isn't working good first issue Good for newcomers labels Mar 16, 2021
@fergusmcdonald
Copy link
Contributor

@ph-fritsche - I've attempted to create a type fix PR in #611

@ph-fritsche ph-fritsche linked a pull request Mar 23, 2021 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants