@@ -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.
@@ -81,10 +83,11 @@ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
81
83
export function render <
82
84
Q extends Queries = typeof queries ,
83
85
Container extends Element | DocumentFragment = HTMLElement ,
86
+ BaseElement extends Element | DocumentFragment = Container ,
84
87
> (
85
88
ui : React . ReactElement ,
86
- options : RenderOptions < Q , Container > ,
87
- ) : RenderResult < Q , Container >
89
+ options : RenderOptions < Q , Container , BaseElement > ,
90
+ ) : RenderResult < Q , Container , BaseElement >
88
91
export function render (
89
92
ui : React . ReactElement ,
90
93
options ?: Omit < RenderOptions , 'queries' > ,
0 commit comments