Skip to content

Typings for event functions requires HTMLElement, but querySelector (et. al) returns Element #149

Closed
@Alxandr

Description

@Alxandr
  • dom-testing-library version: 3.12.0
  • react version: 16.7.0-alpha.0
  • node version: 0.13.0
  • npm (or yarn) version: 1.12.1

Relevant code or config:

fireEvent.click(container.querySelector('.backButton')!);

What you did:

Tried to trigger a click on a result of querySelector.

What happened:

Typescript complained (did not build).

Reproduction:

Any typescript project with the line above should produce the issue.

Problem description:

It disallows code that is perfectly valid.

Suggested solution:

Allow events to accept Element.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions