Use polymorphic variants for some Request properties#68
Use polymorphic variants for some Request properties#68tom-sherman wants to merge 1 commit intoTheSpyder:mainfrom
Conversation
| ~mode=?map(encodeRequestMode, mode), | ||
| ~credentials=?map(encodeRequestCredentials, credentials), | ||
| ~cache=?map(encodeRequestCache, cache), | ||
| ~redirect=?map(encodeRequestRedirect, redirect), |
There was a problem hiding this comment.
I had no idea this =?map syntax was valid 🤨 this was just how it converted from the original OCaml. Looks like it's a convenient way to pass an optional function return value as an optional method argument 🤔
Learn something new every day, I guess!
| module AbortController = Webapi__Fetch__AbortController | ||
|
|
||
| /** Alias for anyone upgrading */ | ||
| /* * Alias for anyone upgrading */ |
There was a problem hiding this comment.
The lack of ReScript support for docs comments is annoying. Maybe we should just delete this comment now 🤷 and arguably the alias, too, since this will be going onto the 2.0 branch
There was a problem hiding this comment.
I'm happy to delete the aliases in a followup PR when all of these are merged as I don't fancy like dealing with the conflicts 😆
spocke
left a comment
There was a problem hiding this comment.
It's a little bit annoying that you need to quote the polymorphic variants when it has a dash in them but I guess that is nothing we can do about except maybe get the compiler to support that syntax.
|
@spocke Yeah it looks quite awkward. I think another way of improving that situation is through IDE autocompletion too. |
fe0f2e9 to
7f2cf0a
Compare
Relates to #30 and #38
Changes
mode,credentials,cache, andredirectto use polymorphic variants.I've left destination and
referrerPolicyuntouched for now as they have some problems. See #38 (comment)