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

refactor: convert test setup to Typescript #739

Merged
merged 2 commits into from
Oct 7, 2021
Merged

refactor: convert test setup to Typescript #739

merged 2 commits into from
Oct 7, 2021

Conversation

ph-fritsche
Copy link
Member

What:

Convert the __test__/helpers/utils to Typescript.

Why:

We want to convert the whole codebase to Typescript because using typed code is easier and less error-prone.

How:

const { element } = setup(`<div></div>`) // element is HTMLElement
const { element } = setup<HTMLDivElement>(`<div></div>`) // element is HTMLDivElement
const { elements: [first, second] } = setup<[HTMLInputElement, HTMLTextareaElement]>(`<input/><textarea></textarea>`)
// first is HTMLInputElement, second is HTMLTextareaElement

This allowed to remove type casts and optional chains.

Checklist:

  • [N/A] Documentation
  • Tests
  • Ready to be merged

@ph-fritsche ph-fritsche changed the title Refactor ts refactor: convert test setup to Typescript Oct 7, 2021
@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 7, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 3f8d48e:

Sandbox Source
userEvent-PR-template Configuration

@ph-fritsche ph-fritsche merged commit a4943d5 into main Oct 7, 2021
@ph-fritsche ph-fritsche deleted the refactor-ts branch October 7, 2021 16:10
@github-actions
Copy link

🎉 This PR is included in version 13.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

1 participant