mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
data: Restrict parameter type to not be undefined.
Since the type of request_method(AjaxRequestHandler) has
been extended in the previous commit.Consequently the 'data'
field of 'request_method' has to be typed such that it
satisfies this change.
Because request_method's type can also be 'typeof patch' which
does not accept undefined 'data' field, I haved 'omit'-ted
'undefined' from 'data's type in function signature to satisfy
TypeScript.
Now ,in support of the changes I have made to two different function
sign(namely setting_ui.do_settings_change,dialog_widget.submit_api_request)
I am stating some points about data field inside these respective
function signs.
1.settings_ui.do_settings_change: For this 'data' was actually never
undefined. Each function call has a 'data' object passed( with one
or more fields).
2.dialog_widget.submit_api_request: For this case many function calls
actually didn't have 'data' field (ie.'data' was undefined).
BUT,for those cases it was defaulted to '{}'(see function sign).
So effectively 'request_method' didn't recieve an undefined 'data' for
this case too. I have removed the defaulting and passed '{}' in the
function calls for those cases, which effectively does the some job,
but satisfies the type.
For both these cases 'data' field isn't undefined and hence an Omit,for me
makes sense.
This commit is contained in:
@@ -98,7 +98,7 @@ function build_page(): void {
|
||||
html_body,
|
||||
id: "confirm_delete_code_playgrounds_modal",
|
||||
on_click() {
|
||||
dialog_widget.submit_api_request(channel.del, url);
|
||||
dialog_widget.submit_api_request(channel.del, url, {});
|
||||
},
|
||||
loading_spinner: true,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user