-
Notifications
You must be signed in to change notification settings - Fork 161
Make the fields of RequestInit optional. #381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the fields of RequestInit optional. #381
Conversation
This way, users do not have to recite every field when creating a RequestInit. Also, the spec says the RequestInit dictionary must contain a field `window` which is set to null. We might as well include this too as a final variable, since the spec shows omitting it should be a type error.
I see, however that |
I think if you pull off the js.native this will work as expected though. Are you going to resubmit? |
@flavomulti I just removed the js.native as you suggested. I remember now that I added that so that the window field could be set to null explicitly. Perhaps the way I have it now will work? |
I think that as long as its not set, e.g. js.undefined, its ok not to specify it. If you do specify window, it must be null...something like that. It's never clear why funky things like this exist, but it is what it is. |
It is ok if window is undefined, it just must not have a value other than `null` if defined.
Ah, that makes sense. So this will still throw a typeerror if a user tries to set it to something that's not null, which is what the spec wants. Ok thanks @flavomulti ! |
Is there anyway to get this merged? With 1.0 out, we really need js.undefined on the RequestInit trait's properties as it is very unergonomic to use otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Sorry for being so late in answering this. Thanks for the PR.
I just have one comment below:
Thank you @zakpatterson |
Thanks! |
This way, users do not have to recite every field when creating a
RequestInit
. Also, the spec says theRequestInit
dictionary must contain a fieldwindow
which is set to null. We might as well include this too as a final variable, since the spec shows omitting it should be a type error.Prompted by gitter conversation here: https://gitter.im/scala-js/scala-js?at=5d80415105fd3716953afa47