rescript-webapi icon indicating copy to clipboard operation
rescript-webapi copied to clipboard

Look at ways to reduce code generation

Open TheSpyder opened this issue 4 years ago • 1 comments

Tasks already logged:

  • #3 (removes asHtmlDocument function, and probably a few others)
  • #7 (reduces need for 'convert' functions)
  • #30 (the generated JS for bs-fetch that 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

TheSpyder avatar Oct 31 '21 10:10 TheSpyder

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?

tom-sherman avatar Dec 21 '21 17:12 tom-sherman