Regression: Types of property `hydrate` are incompatible in `renderHook` options
samettttt opened this issue · comments
@testing-library/react
version: 15.0.4- Testing Framework and version: vitest 1.5.0
- DOM Environment: jsdom
Relevant code or config:
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 });
};
What you did:
We use the RenderHookOptions
type for a parameter in a helper function where we call renderHook
.
What happened:
![Screenshot 2024-04-24 at 20 49 01](https://private-user-images.githubusercontent.com/27175290/325345985-c82bc148-e4be-43b8-9f32-83cf04a8e51c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA2MDkxNzIsIm5iZiI6MTcyMDYwODg3MiwicGF0aCI6Ii8yNzE3NTI5MC8zMjUzNDU5ODUtYzgyYmMxNDgtZTRiZS00M2I4LTlmMzItODNjZjA0YThlNTFjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzEwVDEwNTQzMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIwMTA0MDczN2FkNGQwZDA2MGVjYzhkNWQyOTZhZjJiYmVlNDViZGY4N2VhYjkwYWFiOGNmOWEyZTdkNTNmMzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Lalj3EvXQSQ6kH3JZiJ2W3mP0z_BojsoHAw07V_lVEk)
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.