Skip to content

fix: Stop restricting container option based on hydrate#1313

Merged
eps1lon merged 2 commits intotesting-library:mainfrom
eps1lon:simple-container
Apr 26, 2024
Merged

fix: Stop restricting container option based on hydrate#1313
eps1lon merged 2 commits intotesting-library:mainfrom
eps1lon:simple-container

Conversation

@eps1lon
Copy link
Member

@eps1lon eps1lon commented Apr 24, 2024

Closes #1312
Closes #1311

It's really not worth it to have such extensive types just to restrict container properly. Especially because it makes composing render and renderHook so hard. And we do want to encourage wrapping render in your tests.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 24, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit f5f9f9e:

Sandbox Source
react-testing-library-examples Configuration

{
"extends": "../node_modules/kcd-scripts/shared-tsconfig.json",
"compilerOptions": {
"skipLibCheck": false
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never actually typechecked the .d.ts files before.


export interface BaseRenderHookOptions<
/** @deprecated */
export type BaseRenderHookOptions<
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just so I'll understand, what's the motivation with changing this one from an interface to a type?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just an alias for RenderHookOptions whereas an interface would create a new type.

@eps1lon eps1lon changed the title Stop restricting container option based on hydrate fix: Stop restricting container option based on hydrate Apr 26, 2024
@eps1lon eps1lon merged commit d143f46 into testing-library:main Apr 26, 2024
@eps1lon eps1lon deleted the simple-container branch April 26, 2024 10:50
izzieSD pushed a commit to Izzie132/legit that referenced this pull request Feb 19, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@testing-library/react](https://github.com/testing-library/react-testing-library) | devDependencies | major | [`^14.1.2` -> `^15.0.0`](https://renovatebot.com/diffs/npm/@testing-library%2freact/14.2.1/15.0.5) |

---

### Release Notes

<details>
<summary>testing-library/react-testing-library (@&#8203;testing-library/react)</summary>

### [`v15.0.5`](https://github.com/testing-library/react-testing-library/releases/tag/v15.0.5)

[Compare Source](testing-library/react-testing-library@v15.0.4...v15.0.5)

##### Bug Fixes

-   Stop restricting `container` option based on `hydrate` ([#&#8203;1313](testing-library/react-testing-library#1313)) ([d143f46](testing-library/react-testing-library@d143f46))

### [`v15.0.4`](https://github.com/testing-library/react-testing-library/releases/tag/v15.0.4)

[Compare Source](testing-library/react-testing-library@v15.0.3...v15.0.4)

##### Bug Fixes

-   Ensure `renderHook` options extend options for `render` ([#&#8203;1308](testing-library/react-testing-library#1308)) ([48282c2](testing-library/react-testing-library@48282c2))

### [`v15.0.3`](https://github.com/testing-library/react-testing-library/releases/tag/v15.0.3)

[Compare Source](testing-library/react-testing-library@v15.0.2...v15.0.3)

##### Bug Fixes

-   Don't raise TypeScript errors when hydating `document` ([#&#8203;1304](testing-library/react-testing-library#1304)) ([067d0c6](testing-library/react-testing-library@067d0c6))

### [`v15.0.2`](https://github.com/testing-library/react-testing-library/releases/tag/v15.0.2)

[Compare Source](testing-library/react-testing-library@v15.0.1...v15.0.2)

##### Bug Fixes

-   Improve `legacyRoot` error message ([#&#8203;1301](testing-library/react-testing-library#1301)) ([c63b873](testing-library/react-testing-library@c63b873))

### [`v15.0.1`](https://github.com/testing-library/react-testing-library/releases/tag/v15.0.1)

[Compare Source](testing-library/react-testing-library@v15.0.0...v15.0.1)

##### Bug Fixes

-   Stop using nullish coalescing ([#&#8203;1299](testing-library/react-testing-library#1299)) ([1645d21](testing-library/react-testing-library@1645d21))

### [`v15.0.0`](https://github.com/testing-library/react-testing-library/releases/tag/v15.0.0)

[Compare Source](testing-library/react-testing-library@v14.3.1...v15.0.0)

##### Relea...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: Types of property hydrate are incompatible in renderHook options TypeScript error with skipLibCheck false

2 participants