Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type RenderResult<
maxLength?: number,
options?: prettyFormat.OptionsReceived,
) => void
rerender: (ui: React.ReactElement) => void
rerender: (ui: React.ReactNode) => void
unmount: () => void
asFragment: () => DocumentFragment
} & {[P in keyof Q]: BoundFunction<Q[P]>}
Expand Down Expand Up @@ -90,7 +90,7 @@ export interface RenderOptions<
*
* @see https://testing-library.com/docs/react-testing-library/api/#wrapper
*/
wrapper?: React.JSXElementConstructor<{children: React.ReactElement}>
wrapper?: React.JSXElementConstructor<{children: React.ReactNode}>
}

type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
Expand All @@ -103,11 +103,11 @@ export function render<
Container extends Element | DocumentFragment = HTMLElement,
BaseElement extends Element | DocumentFragment = Container,
>(
ui: React.ReactElement,
ui: React.ReactNode,
options: RenderOptions<Q, Container, BaseElement>,
): RenderResult<Q, Container, BaseElement>
export function render(
ui: React.ReactElement,
ui: React.ReactNode,
options?: Omit<RenderOptions, 'queries'>,
): RenderResult

Expand Down
8 changes: 4 additions & 4 deletions types/test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,18 @@ export function testQueries() {
}

export function wrappedRender(
ui: React.ReactElement,
ui: React.ReactNode,
options?: pure.RenderOptions,
) {
const Wrapper = ({children}: {children: React.ReactElement}): JSX.Element => {
const Wrapper = ({children}: {children: React.ReactNode}): JSX.Element => {
return <div>{children}</div>
}

return pure.render(ui, {wrapper: Wrapper, ...options})
}

export function wrappedRenderB(
ui: React.ReactElement,
ui: React.ReactNode,
options?: pure.RenderOptions,
) {
const Wrapper: React.FunctionComponent<{children?: React.ReactNode}> = ({
Expand All @@ -147,7 +147,7 @@ export function wrappedRenderB(
}

export function wrappedRenderC(
ui: React.ReactElement,
ui: React.ReactNode,
options?: pure.RenderOptions,
) {
interface AppWrapperProps {
Expand Down