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

Type Error Occurs When Trying to Use React with createClient #87

Open
p-chan opened this issue Feb 22, 2024 · 1 comment
Open

Type Error Occurs When Trying to Use React with createClient #87

p-chan opened this issue Feb 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@p-chan
Copy link

p-chan commented Feb 22, 2024

What version of HonoX are you using?

0.1.4

What steps can reproduce the bug?

I attempted to set up the React renderer as described in the README, but encountered a type error.

Write ./app/client.ts.

import { createClient } from "honox/client";

createClient({
  hydrate: async (elem, root) => {
    const { hydrateRoot } = await import("react-dom/client");
    hydrateRoot(root, elem);
  },
  createElement: async (type: any, props: any) => {
    const { createElement } = await import("react");
    return createElement(type, props);
  },
});

Type Error Occurs.

Screenshot 2024-02-23 at 6 50 34

1. For the part hydrateRoot(root, elem);

Argument of type 'Node' is not assignable to parameter of type 'ReactNode'.

2. For the part createElement

Type '(type: any, props: any) => Promise<React.CElement<any, React.Component<any, any, any>>>' is not assignable to type 'CreateElement'.
  Type 'Promise<CElement<any, Component<any, any, any>>>' is not assignable to type 'Node | Promise<Node>'.
    Type 'Promise<CElement<any, Component<any, any, any>>>' is not assignable to type 'Promise<Node>'.
      Type 'ComponentElement<any, Component<any, any, any>>' is missing the following properties from type 'Node': baseURI, childNodes, firstChild, isConnected, and 46 more.

What is the expected behavior?

I expect that no type errors will occur.

What do you see instead?

No response

Additional information

It seems the same issue occurs at https://github.com/yusukebe/honox-playground/tree/main/projects/react.
If necessary, I can create a minimal sandbox to reproduce the issue.

@p-chan p-chan added the bug Something isn't working label Feb 22, 2024
@yusukebe
Copy link
Member

Hi @p-chan

This is a known issue. So you don't have to create a project to reproduce! We can handle this later. Thanks!

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

No branches or pull requests

2 participants