@@ -14,9 +14,10 @@ export * from '@testing-library/dom'
14
14
export type RenderResult <
15
15
Q extends Queries = typeof queries ,
16
16
Container extends Element | DocumentFragment = HTMLElement ,
17
+ BaseElement extends Element | DocumentFragment = Container ,
17
18
> = {
18
19
container : Container
19
- baseElement : Element
20
+ baseElement : BaseElement
20
21
debug : (
21
22
baseElement ?:
22
23
| Element
@@ -33,6 +34,7 @@ export type RenderResult<
33
34
export interface RenderOptions <
34
35
Q extends Queries = typeof queries ,
35
36
Container extends Element | DocumentFragment = HTMLElement ,
37
+ BaseElement extends Element | DocumentFragment = Container ,
36
38
> {
37
39
/**
38
40
* By default, React Testing Library will create a div and append that div to the document.body. Your React component will be rendered in the created div. If you provide your own HTMLElement container via this option,
@@ -50,7 +52,7 @@ export interface RenderOptions<
50
52
*
51
53
* @see https://testing-library.com/docs/react-testing-library/api/#baseelement
52
54
*/
53
- baseElement ?: Element
55
+ baseElement ?: BaseElement
54
56
/**
55
57
* If `hydrate` is set to `true`, then it will render with `ReactDOM.hydrate`. This may be useful if you are using server-side
56
58
* rendering and use ReactDOM.hydrate to mount your components.
@@ -75,7 +77,7 @@ export interface RenderOptions<
75
77
*
76
78
* @see https://testing-library.com/docs/react-testing-library/api/#wrapper
77
79
*/
78
- wrapper ?: React . ComponentType
80
+ wrapper ?: React . JSXElementConstructor < { children : React . ReactElement } >
79
81
}
80
82
81
83
type Omit < T , K extends keyof T > = Pick < T , Exclude < keyof T , K > >
@@ -86,10 +88,11 @@ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
86
88
export function render <
87
89
Q extends Queries = typeof queries ,
88
90
Container extends Element | DocumentFragment = HTMLElement ,
91
+ BaseElement extends Element | DocumentFragment = Container ,
89
92
> (
90
93
ui : React . ReactElement ,
91
- options : RenderOptions < Q , Container > ,
92
- ) : RenderResult < Q , Container >
94
+ options : RenderOptions < Q , Container , BaseElement > ,
95
+ ) : RenderResult < Q , Container , BaseElement >
93
96
export function render (
94
97
ui : React . ReactElement ,
95
98
options ?: Omit < RenderOptions , 'queries' > ,
0 commit comments