rescript-webapi
rescript-webapi copied to clipboard
Look at ways to reduce code generation
Tasks already logged:
- #3 (removes
asHtmlDocumentfunction, and probably a few others) - #7 (reduces need for 'convert' functions)
- #30 (the generated JS for
bs-fetchthat we imported is 400 lines long, mostly due to lacking ReScript techniques added after it was written) - #74 (one of the scenarios where runtime wrapper code can now be replaced with polymorphic variants)
But I'd still like to note this as a general task to analyse the generated JS and see if ReScript techniques can be used to reduce the amount of it.
Mainly techniques like the ones described here https://rescript-lang.org/docs/manual/latest/bind-to-js-function#trick-2-polymorphic-variant--unwrap
I tried to change Request.referrerPolicy to a polyvar in #66 but it ultimately didn't work as it uncovered a rescript formatting bug. See comment on PR for details.
I believe the same applies to destination.
Is there another way?