tyxml icon indicating copy to clipboard operation
tyxml copied to clipboard

Don't fix the type of children in jsx

Open jfrolich opened this issue 4 years ago • 2 comments

The idea is that children is just a prop. In the jsx-ppx the children type is fixed, which is fine for normal elements, but it allows less flexibility for custom components.

jfrolich avatar Jun 22 '20 14:06 jfrolich

Hmm, unfortunately we can't really do that one. The content of the nodes are a pseudo-list. For most implementation, that's the normal lists. However for things like reactive nodes it's not: we use the specific list constructions, specialized to the Tyxml elements in question.

We would have to change the type of the underlying list operations, and that break compat :/

Drup avatar Jun 22 '20 22:06 Drup

But isn't it possible not to have a forced type annotation on the children argument of the createElement function when using JSX to construct those function calls? (If I call a createElement function without JSX it works great but somehow JSX is forcing a certain type on ~children.).

jfrolich avatar Jun 23 '20 08:06 jfrolich