diff --git a/types/index.d.ts b/types/index.d.ts index 439dddbf..55bf2af1 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -3,7 +3,7 @@ import * as ReactDOMClient from 'react-dom/client' import { queries, Queries, - BoundFunction, + BoundFunctions, prettyFormat, Config as ConfigDTL, } from '@testing-library/dom' @@ -44,7 +44,11 @@ export type RenderResult< rerender: (ui: React.ReactNode) => void unmount: () => void asFragment: () => DocumentFragment -} & {[P in keyof Q]: BoundFunction} +} & { + [P in keyof Q]: P extends keyof BoundFunctions + ? BoundFunctions[P] + : never +} /** @deprecated */ export type BaseRenderOptions< diff --git a/types/test.tsx b/types/test.tsx index 10e6c303..70429359 100644 --- a/types/test.tsx +++ b/types/test.tsx @@ -296,6 +296,44 @@ export function testErrorHandlers() { }) } +export async function testGenericQueryElementTypes() { + const view = pure.render(