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

fix: export typings from src #596

Merged
merged 1 commit into from Mar 19, 2021
Merged

fix: export typings from src #596

merged 1 commit into from Mar 19, 2021

Conversation

ph-fritsche
Copy link
Member

What:

Export typings from src.
Fix missing exported specialChars object.

Why:

Closes #594
Closes #593

How:

Remove typings.
Convert src/index.js to Typescript and add typings for exported JS modules in src.

Checklist:

  • N/A Documentation
  • N/A Tests
  • Typings
  • Ready to be merged

@codecov
Copy link

codecov bot commented Mar 19, 2021

Codecov Report

Merging #596 (f24d720) into master (2180430) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #596   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           47        47           
  Lines          862       862           
  Branches       327       327           
=========================================
  Hits           862       862           
Impacted Files Coverage Δ
src/index.ts 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2180430...f24d720. Read the comment docs.

@ph-fritsche ph-fritsche merged commit 16314c6 into master Mar 19, 2021
@ph-fritsche ph-fritsche deleted the fix-594 branch March 19, 2021 12:01
@github-actions
Copy link

🎉 This PR is included in version 13.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nstepien
Copy link

This is making things worse for us, for example:

src/...test.tsx:271:15 - error TS2554: Expected 2-3 arguments, but got 1.

271     userEvent.click(screen.getByLabelText(/only show changes/i));
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/@testing-library/user-event/dist/click.d.ts:1:37
    1 export function click(element: any, init: any, { skipHover, clickCount }?: {
                                          ~~~~~~~~~
    An argument for 'init' was not provided.

Same issue for hover, unhover, dblClick, and more.
TargetElement used to be exported but not anymore.

@ph-fritsche
Copy link
Member Author

@nstepien Thanks for the report.
Rollup removed the types from lib.dom.d.ts 🤦

@ph-fritsche
Copy link
Member Author

@nstepien Could you have a look at #599 ?

@ph-fritsche
Copy link
Member Author

Check out v13.0.4 🚀

@riboher
Copy link

riboher commented Mar 23, 2021

Hi there! Issue with exporting TargetElement is still happening after updating to v13.0.7 😞 . Typescript is complaining about TargetElement not being exported in @testing-library/user-event

@ph-fritsche
Copy link
Member Author

@riboher Yes, TargetElement is completely removed.
It was Element | Window and used in multiple places, where the actual typings were different. It won't come back.

What have you been using it for?

@riboher
Copy link

riboher commented Mar 23, 2021

Oh! Ok! Good to know then. Just needed it for typing one of my tests and make sure a nextSibling was correctly typed for an upload event. You say I can try with Element then? Thanks!

@ph-fritsche
Copy link
Member Author

user-event/src/upload.ts

Lines 16 to 17 in 4c3d3cf

function upload(
element: HTMLInputElement | HTMLLabelElement,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants