Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Types of property hydrate are incompatible in renderHook options #1312

Closed
samettttt opened this issue Apr 24, 2024 · 0 comments · Fixed by #1313
Closed

Regression: Types of property hydrate are incompatible in renderHook options #1312

samettttt opened this issue Apr 24, 2024 · 0 comments · Fixed by #1313
Assignees
Labels
bug Something isn't working

Comments

@samettttt
Copy link

samettttt commented Apr 24, 2024

  • @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

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.

@eps1lon eps1lon self-assigned this Apr 24, 2024
@eps1lon eps1lon added the bug Something isn't working label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants