fix: incorrect typings for Modal hide() method (#3180)

* fix: incorrect typings for `hide()`

* fix: swap to arrow calling of hide handler
This commit is contained in:
David Wheatley 2021-11-23 22:54:26 +00:00 committed by GitHub
parent aa0b68bc8d
commit afbf5f4905
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,7 +93,7 @@ export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IIn
<div className="Modal-close App-backControl">
{Button.component({
icon: 'fas fa-times',
onclick: this.hide.bind(this),
onclick: () => this.hide(),
className: 'Button Button--icon Button--link',
'aria-label': app.translator.trans('core.lib.modal.close'),
})}
@ -148,14 +148,14 @@ export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IIn
/**
* Hides the modal.
*/
hide() {
hide(): void {
this.attrs.state.close();
}
/**
* Sets `loading` to false and triggers a redraw.
*/
loaded() {
loaded(): void {
this.loading = false;
m.redraw();
}
@ -164,7 +164,7 @@ export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IIn
* Shows an alert describing an error returned from the API, and gives focus to
* the first relevant field involved in the error.
*/
onerror(error: RequestError) {
onerror(error: RequestError): void {
this.alertAttrs = error.alert;
m.redraw();