WIP - Try and transform jsx through compilation#7385
WIP - Try and transform jsx through compilation#7385nojaf wants to merge 1 commit intorescript-lang:masterfrom
Conversation
nojaf
left a comment
There was a problem hiding this comment.
Hello @cristianoc, curious to hear your thoughts on this!
//cc @zth
| false ) | ||
| | _ -> None) | ||
| in | ||
| let record = Ast_helper.Exp.record fields None in |
There was a problem hiding this comment.
This idea here is to create a record of JsxDOM.domProps and type-check that.
It is of course laser focused to the <div> example.
(children could later be checked separately, as I believe we need to check if those Jsx.element)
| let path = Path.Pdot (Path.Pident (Ident.create "Jsx"), "element", 0) in | ||
| Ctype.newconstr path [] | ||
| in | ||
| let _typed_record = type_expect_ env record jsx_dom_type_expected in |
There was a problem hiding this comment.
jsx_dom_type_expected isn't quite right here. Could we maybe try and find it in the env?
| let _typed_record = type_expect_ env record jsx_dom_type_expected in | ||
| { | ||
| exp_desc = | ||
| Texp_jsx_container_element |
There was a problem hiding this comment.
We transform this node a couple of times later on, in all the phases but overall the important check happened here.
|
After looking at how complexity builds up, perhaps this was not the best suggestion. Thoughts? |
|
I agree that this touches on many layers, and the impact of breaking something is considerable. Marking the transformed application call with additional data could also be effective. I would support adding the original We could ultimately detect it in |
|
I'm more in favor for #7387 |
Super rough experiment about type-checking the new Jsx untyped nodes.
Current attempt is to compile
let x = <div className="yow"></div>and print jsx injs_dump.Current result: