diff --git a/types/index.d.ts b/types/index.d.ts index 4d599256..6d0c67ee 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -47,7 +47,7 @@ type Omit = Pick> * Render into a container which is appended to document.body. It should be used with cleanup. */ export function render< - Q extends Queries, + Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement >( ui: React.ReactElement, diff --git a/types/test.tsx b/types/test.tsx index 7cc0e015..01105c06 100644 --- a/types/test.tsx +++ b/types/test.tsx @@ -84,6 +84,22 @@ export async function testWaitFor() { await waitFor(() => {}) } +export function testQueries() { + const {getByLabelText} = render( + , + ) + expectType>( + getByLabelText('Username'), + ) + + const container = document.createElement('div') + const options = {container} + const {getByText} = render(
Hello World
, options) + expectType>( + getByText('Hello World'), + ) +} + /* eslint testing-library/prefer-explicit-assert: "off",