Closed
Description
@testing-library/react
version: 11.2.2- Testing Framework and version: irrelevant
- DOM Environment: irrelevant
Relevant code or config:
it('example', () => {
const { container } = render(<span>foo</span>); // container type is Element
getByText(container as HTMLElement, 'foo'); // can't use container here without casting to HTMLElement
});
What you did:
I tried to use container in custom query.
What happened:
Types do not match without manual casting.
Reproduction:
https://codesandbox.io/s/react-testing-library-demo-forked-bt601?file=/src/__tests__/hello.tsx
Suggested solution:
Loosening type requirements for element provided to Queries