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 'VNode[]' is not assignable to type 'ReactFragment' #8

Closed
ozcanxbreeze opened this issue Apr 18, 2023 · 7 comments
Closed

Type 'VNode[]' is not assignable to type 'ReactFragment' #8

ozcanxbreeze opened this issue Apr 18, 2023 · 7 comments

Comments

@ozcanxbreeze
Copy link
Contributor

in packages/src/views the error 'Type 'VNode[]' is not assignable to type 'ReactFragment'' is thrown. This does not happen in the ecore example (https://github.com/eclipse-emfcloud/ecore-glsp).

It works in the browser but the error is shown while compiling the application. Might be something wrong with the dependencies or configuration files.

@ozcanxbreeze
Copy link
Contributor Author

@martin-fleck-at Could you take a look at this?

@martin-fleck-at
Copy link
Collaborator

martin-fleck-at commented Apr 18, 2023

@ozcanxbreeze I think it has to do with the different versions of React or Theia in Ecore GLSP. Ecore GLSP is using React 16 whereas we are using React 18 or there could be a version issue somewhere. Just from a quick glance I could not really detect the problem as the same code seems to work in other places. As a workaround for now we can definitely use {context.renderChildren(node) as ReactNode} to make sure Typescript accepts it. But I'll look into this a bit more just to see what could be causing this and post another update.

Btw, I found a really nice project that provides a UML editor based on GLSP which also looks similar to what you want to achieve: https://github.com/borkdominik/bigUML. I have not really tried working with it, just saw it and thought it might be of interest to you.

@martin-fleck-at
Copy link
Collaborator

@ozcanxbreeze I asked around with my colleagues and it seems that is a known issue of combining Sprotty (from GLSP) with React, see eclipse-sprotty/sprotty#178 and theia-ide/sprotty#203, that only showed up with React 18. I tried setting the types to [] as suggested in one of the tickets but it did not make any difference for me. So either we separate out the GLSP views into a separate package with different configurations to see if that works or we accept the explicit casting for now to make the typescript compiler happy.

@ozcanxbreeze
Copy link
Contributor Author

Great, I think the explicit casting is fine for now. @harmen-xb what do you think?

@harmen-xb
Copy link
Contributor

@ozcanxbreeze I agree casting is fine. It's only a workaround for the IDE, the actual program works fine. Can you link the changeset where you added the cast in this issue, then it can be closed.

@ozcanxbreeze
Copy link
Contributor Author

see #11

@ozcanxbreeze
Copy link
Contributor Author

Done and also merged into the main branch

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

No branches or pull requests

3 participants