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

Usage with react #178

Closed
schwichti opened this issue Apr 24, 2020 · 2 comments
Closed

Usage with react #178

schwichti opened this issue Apr 24, 2020 · 2 comments

Comments

@schwichti
Copy link

Hi.
I am using sprotty in an react app. I just want to let you know, that the typescript compiler gives me some compilation errors like Type 'Element' is missing the following properties from type 'VNode': sel, data, children, elm, text. What I understand is that the compiler expects the render method to return Element from react, but gets VNode from snabbdom. I guess the problem is the same as described here: theia-ide/sprotty#203
In that original issue, a solution has been proposed to use jsx pragma and set the types property in tsconfig to empty array (by the way, the links to the msdn blog in the original issue are broken).
Setting types to empty array did not do the trick for me. I am using ts-ignore which is quite unsatisfying. You can see it here: https://github.com/crossecore/ecore-editor/blob/master/src/views.tsx#L26

@spoenemann
Copy link
Contributor

Yes, using Sprotty and React in the same project is a problem. One solution is to use separate tsconfig.json files (or even separate packages) for the Sprotty related code and the React related code. Another solution is to avoid tsx for Sprotty and use the Snabbdom API directly instead.

@schwichti
Copy link
Author

All suggested solutions have their downsides. I think this is a general problem that should be addressed by the typescript compiler properly. So this can be closed.

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

2 participants