-
Notifications
You must be signed in to change notification settings - Fork 19
Description
After the merge of #66, the code has full control over the types of makeProps
. Many props are defined as string
when in reality (the HTML spec) doesn't allow any string and defines an enum or some sort of combination. It might happen to some props that are defined as int
or bool
as well.
The benefit from moving away from string-based API are:
- Safety, within a string there could be a typo without noticing it.
- Learnability. Users might be able to learn about HTML and their APIs.
- Correctness, generate valid HTML does have a good impact on on-page SEO.
There have been a few efforts on rescript-react
to push that direction but didn't land yet (a few comments by @dodomorandi in rescript-lang/syntax#235) and I'm not sure if there's a positive intent to do so.
We have the possibility to do it.
Other references:
- Polyvariant attributes: to bump or not to bump rescript-lang/rescript-react#10
- https://github.com/rescript-lang/rescript-react/pull/12/files
- WIP: React JSX PPX v4 rescript-lang/syntax#235
The plan for this is to check TyXML and https://html.spec.whatwg.org/#global-attributes and manually ensure that most of our attributes make sense.
Further investigations are on my plate, where I might try to change the html.ml
list of attributes into per-element basis and ensure that the generated HTML from React components is valid.