testing-library / testing-library/dom-testing-library

Convert codebase to TypeScript

Open
#494 20 comments 20 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue help wanted
Dominant language
JavaScript
Stars
3.3k
Forks
474
PR merge metrics
No merged PRs in 30d

Description

Describe the feature you'd like:

Accurate and timely TypeScript types.

Currently types are manually maintained in the @types/ project so they are only updated after the fact and are prone to human error and implementation drift.

Suggested implementation:

Convert @testing-library/dom to TypeScript.

Describe alternatives you've considered:

The main alternative is to leave things the way they are. Unfortunately this leaves types manually updated after the fact. This is slow, depend on third-parties (Microsoft), and is error prone.

I'm sure there are other issues filed on the DefinitelyTyped repo.

Another alternative is to require DefinitelyTyped types as part of general contributions to this project. This would be a big increase to the barrier of entry as contributors would have to know how to write types and update DefinitelyTyped.

Teachability, Documentation, Adoption, Migration Strategy:

I'd look at doing a multi-stage conversion

  1. Initial proof of concept with one or two files to validate the approach and tooling.
  2. The src files
  3. Updated contributing guide with guidance on types
  4. The tests files (this could be delayed until a future date)
  5. Update testing-library.com documentation to display the latest types (optional but if they exists they might as well be used)

TypeScript does add some additional complexity in tooling and would increase the barrier of entry for contributors. This is also an opportunity to to create a simple and supportive implementation that people less familiar with TypeScript and contribute to. It would be important to create some good contributing guides on working with types (or identify and recommend some good third-party guides).

Potentially there would be bugs uncovered and fixed in the codebase with the conversion.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed multi-stage conversion for @testing-library/dom, beginning with the tooling and a proof of concept in one or two files. Then assess the src and tests directories, plus the contributing guide, to define the migration scope. Done means the implementation and types are maintained together, with contributor guidance updated and the proposed stages addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
testing-qa, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.