rescript-webapi
rescript-webapi copied to clipboard
Encode string enums as polymorphic variants
This is a relatively recent feature of ReScript, and will replace the variant-based code that requires runtime functions, for example: https://github.com/tinymce/rescript-webapi/blob/0c9e9211785852e69f2d2a17c765e63c5697217f/src/Webapi/Dom/Webapi__Dom__Element.re#L76-L86
In fact really what I'm talking about is replacing most of (if not all) of DomTypes with polymorphic variants. https://github.com/tinymce/rescript-webapi/blob/main/src/Webapi/Dom/Webapi__Dom__Types.re
~If we switch to ReScript syntax we can even use numbers as poly variants in the most recent release.~ [edit] that's a bad idea because the whole point of variant encoded types is to use names, not numbers.