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

React18 support #34

Merged
merged 4 commits into from
May 29, 2022
Merged

React18 support #34

merged 4 commits into from
May 29, 2022

Conversation

hachibeeDI
Copy link
Contributor

  • npm run build:ts
  • npm run test

I think it is actually "support @types/react-18"...

Issue

In my environment, RoconRoot claims the error like below:

Type '{ children: ReactElement; history: History<State>; }' is not assignable to type 'IntrinsicAttributes & RoconRootProps'.
  Property 'children' does not exist on type 'IntrinsicAttributes & RoconRootProps'.ts(2322)

packge.json:

    "react": "^18.1.0",
    "react-dom": "^18.1.0",
    "@types/react": "^18.0.9",
    "@types/react-dom": "^18.0.5",

What is this PR contains

  • upgrade dependency
  • fix test cases broken caused by the upgrade
  • declare childern explicitly

Cheers!

VFC is get obsolete and now FC is it
React says, the child of `ReactPortal` should be ReactNode

```
Type 'FunctionComponentElement<never>' is not assignable to type 'ReactNode'.
  Property 'children' is missing in type 'FunctionComponentElement<never>' but required in type
  'ReactPortal'.ts(2322)
```
@@ -33,7 +33,7 @@ describe("Link", () => {
renderInHistory(history, <Component />);
expect(screen.queryByText("I AM BAR")).toBeNull();
expect(history.index).toBe(0);
screen.queryByTestId("link")?.click();
fireEvent.click(screen.queryByTestId("link")!);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just abbused non-null assertion. Let me know if you prefer decent null check condition for that.

Copy link
Owner

@uhyo uhyo left a comment

Choose a reason for hiding this comment

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

Thank you!
The fix seems nice and also looks backwards compatible.

@uhyo uhyo merged commit caadc9d into uhyo:master May 29, 2022
@hachibeeDI
Copy link
Contributor Author

Thanks!

@hachibeeDI hachibeeDI deleted the fix/fc-vfc branch May 29, 2022 23:24
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