Closed samettttt closed 2 months ago
@testing-library/react
import { RenderHookOptions, renderHook } from '@testing-library/react'; export const renderHookHelper = <TProps, TResult>( callback: (props: TProps) => TResult, options: RenderHookOptions<TProps> = {}, ) => { // ... // bunch of code // ... return renderHook(callback, { ...options }); };
We use the RenderHookOptions type for a parameter in a helper function where we call renderHook.
RenderHookOptions
renderHook
https://stackblitz.com/edit/rtl-template-22bvkk?file=src%2FApp.test.tsx
We can't simply use the RenderHookOptions type in our helper function. There are workaround to this problem but I thought that maybe this change was not intentional.
@testing-library/react
version: 15.0.4Relevant code or config:
What you did:
We use the
RenderHookOptions
type for a parameter in a helper function where we callrenderHook
.What happened:
Reproduction:
https://stackblitz.com/edit/rtl-template-22bvkk?file=src%2FApp.test.tsx
Problem description:
We can't simply use the
RenderHookOptions
type in our helper function. There are workaround to this problem but I thought that maybe this change was not intentional.