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

Fix type import from react-dom #1337

Closed
wants to merge 1 commit into from
Closed

Conversation

grncdr
Copy link

@grncdr grncdr commented Jun 20, 2024

What:

Fix the imported Container type from react-dom

Why:

The react-dom/client module does not export the Container type, only react-dom does.

How:

Updating types/index.d.ts

Checklist:

  • Documentation added to the
    docs site
    (N/A)
  • Tests (N/A)
  • TypeScript definitions updated
  • Ready to be merged

Thanks for the great library! 👍

The `react-dom/client` module does not export the `Container` type.
Copy link

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 4702151:

Sandbox Source
react-testing-library-examples Configuration

@MatanBobi
Copy link
Member

Hi @grncdr, thanks for taking the time to open this.

Container does exist in react-dom/client as can be seen here:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/b0ea84700707b027d6eb37328b16b294dcc9d31a/types/react-dom/client.d.ts#L41

But it really depends on the type of ReactDOM you're using. The separation didn't exist in React 17 AFAIR.

@MatanBobi MatanBobi closed this Jun 20, 2024
@grncdr
Copy link
Author

grncdr commented Jun 20, 2024

Hi @MatanBobi, first sorry for opening a spurious issue, and thanks for the pointer to the actual problem.

I'm using React 18 but didn't notice @types/react-dom had been pinned to 18.0.1 via a yarn resolution. Updating to 18.3.0 resolved it for me. 👍

@grncdr grncdr deleted the patch-1 branch June 20, 2024 15:12
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.

2 participants