-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
DefinitelyTyped/DefinitelyTyped
#41237Labels
TypeScriptRelated to TypeScript. Note: only certain maintainers handle TypeScript labeled issues.Related to TypeScript. Note: only certain maintainers handle TypeScript labeled issues.help wantedExtra attention is neededExtra attention is needed
Description
react-testing-libraryversion: 7.0.0reactversion: 16.8.4nodeversion: 8.12.0npm(oryarn) version: 6.9.0
Relevant code or config:
const { findByLabelText } = render(
<div />,
);
expect(await findByLabelText('anything', undefined, { timeout: 100 }))
.toHaveAttribute(
'aria-checked',
'mixed',
);What you did:
Per the docs, the findBy queries accept the waitForElement options as the last argument. The TypeScript configuration only reflects a possible 1-2 arguments instead of the expected 1-3.
I suspect this has to do with how RenderResult (
react-testing-library/typings/index.d.ts
Lines 19 to 34 in 960451b
| export type RenderResult<Q extends Queries = typeof queries> = { | |
| container: HTMLElement | |
| baseElement: HTMLElement | |
| debug: (baseElement?: HTMLElement | DocumentFragment) => void | |
| rerender: (ui: React.ReactElement<any>) => void | |
| unmount: () => boolean | |
| asFragment: () => DocumentFragment | |
| } & {[P in keyof Q]: BoundFunction<Q[P]>} | |
| export interface RenderOptions<Q extends Queries = typeof queries> { | |
| container?: HTMLElement | |
| baseElement?: HTMLElement | |
| hydrate?: boolean | |
| queries?: Q | |
| wrapper?: React.ComponentType | |
| } |
& {[P in keyof Q]: BoundFunction<Q[P]>) with queries via BoundFunction (https://github.com/testing-library/dom-testing-library/blob/4fb00936cbf5b0d715f5b54d16576dc3bfe20460/typings/get-queries-for-element.d.ts#L4-L14).
I'd love to help; I'm hazy on how exactly the following works; which is where I believe the problem lies:
wezleytsai
Metadata
Metadata
Assignees
Labels
TypeScriptRelated to TypeScript. Note: only certain maintainers handle TypeScript labeled issues.Related to TypeScript. Note: only certain maintainers handle TypeScript labeled issues.help wantedExtra attention is neededExtra attention is needed