From a61a0d5f7da0acdb72312281d3d02e225e30d288 Mon Sep 17 00:00:00 2001 From: eps1lon Date: Mon, 1 Feb 2021 11:12:22 +0100 Subject: [PATCH] Prefer input container in output container type inference --- types/index.d.ts | 8 ++++---- types/test.tsx | 6 +----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 574ded26..4d599256 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -46,10 +46,6 @@ type Omit = Pick> /** * Render into a container which is appended to document.body. It should be used with cleanup. */ -export function render( - ui: React.ReactElement, - options?: Omit, -): RenderResult export function render< Q extends Queries, Container extends Element | DocumentFragment = HTMLElement @@ -57,6 +53,10 @@ export function render< ui: React.ReactElement, options: RenderOptions, ): RenderResult +export function render( + ui: React.ReactElement, + options?: Omit, +): RenderResult /** * Unmounts React trees that were mounted with render. diff --git a/types/test.tsx b/types/test.tsx index 0d3f172b..7cc0e015 100644 --- a/types/test.tsx +++ b/types/test.tsx @@ -44,11 +44,7 @@ export function testRenderOptions() { const container = document.createElement('div') const options = {container} const {container: returnedContainer} = render(