From 3813b88a8a779a2deb61f2de3abe97e79dada52a Mon Sep 17 00:00:00 2001 From: Michael Peyper Date: Sun, 10 Jan 2021 06:59:43 +1100 Subject: [PATCH] fix: constrain TOptions to be an object instead of an empty interface --- src/core/index.ts | 7 ++++++- src/types/index.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/index.ts b/src/core/index.ts index 608bc732..3895589a 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -40,7 +40,12 @@ function resultContainer(): ResultContainer { } } -function createRenderHook>( +function createRenderHook< + TProps, + TResult, + TOptions extends object, + TRenderer extends Renderer +>( createRenderer: CreateRenderer ): RenderHook { const renderHook: RenderHook = ( diff --git a/src/types/index.ts b/src/types/index.ts index 3e580e74..cd4fbd19 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -47,7 +47,7 @@ export type RenderHookResult< Omit> & AsyncUtils -export type RenderHookOptions = TOptions & { +export type RenderHookOptions = TOptions & { initialProps?: TProps }