Skip to content

Argument of type 'Element' is not assignable to parameter of type 'HTMLElement'. #838

Closed
@Semigradsky

Description

@Semigradsky
  • @testing-library/react version: 11.2.2

Relevant code or config:

	const { container } = render( // container is `Element` here
		<MyComponent/>,
	)

	expect(getByText(container, someText)).toBeInTheDocument() // Error: Argument of type 'Element' is not assignable to parameter of type 'HTMLElement'.
	expect(getByTestId(container, 'test-id')).toBeInTheDocument() // Error: Argument of type 'Element' is not assignable to parameter of type 'HTMLElement'.

Problem description:

After testing-library/react-testing-library#833 I get type errors because container no more HTMLElement.

container as HTMLElement doesn't seem like a good solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions