From 5bf83b80d7d2749719dd1a280ae8e205fbc4b2a9 Mon Sep 17 00:00:00 2001 From: Alexey Vinogradov Date: Wed, 3 Jun 2020 20:08:27 +0700 Subject: [PATCH] feat(all): add optional generics typings for overlay component methods (#21393) --- core/api.txt | 28 +++++++++---------- core/src/components.d.ts | 28 +++++++++---------- .../components/action-sheet/action-sheet.tsx | 4 +-- core/src/components/action-sheet/readme.md | 8 +++--- core/src/components/alert/alert.tsx | 4 +-- core/src/components/alert/readme.md | 8 +++--- core/src/components/loading/loading.tsx | 4 +-- core/src/components/loading/readme.md | 8 +++--- core/src/components/modal/modal.tsx | 4 +-- core/src/components/modal/readme.md | 8 +++--- core/src/components/picker/picker.tsx | 4 +-- core/src/components/picker/readme.md | 8 +++--- core/src/components/popover/popover.tsx | 4 +-- core/src/components/popover/readme.md | 8 +++--- core/src/components/toast/readme.md | 8 +++--- core/src/components/toast/toast.tsx | 4 +-- 16 files changed, 70 insertions(+), 70 deletions(-) diff --git a/core/api.txt b/core/api.txt index a6f7e89801..e9086b0e57 100644 --- a/core/api.txt +++ b/core/api.txt @@ -12,8 +12,8 @@ ion-action-sheet,prop,mode,"ios" | "md",undefined,false,false ion-action-sheet,prop,subHeader,string | undefined,undefined,false,false ion-action-sheet,prop,translucent,boolean,false,false,false ion-action-sheet,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise -ion-action-sheet,method,onDidDismiss,onDidDismiss() => Promise> -ion-action-sheet,method,onWillDismiss,onWillDismiss() => Promise> +ion-action-sheet,method,onDidDismiss,onDidDismiss() => Promise> +ion-action-sheet,method,onWillDismiss,onWillDismiss() => Promise> ion-action-sheet,method,present,present() => Promise ion-action-sheet,event,ionActionSheetDidDismiss,OverlayEventDetail,true ion-action-sheet,event,ionActionSheetDidPresent,void,true @@ -58,8 +58,8 @@ ion-alert,prop,mode,"ios" | "md",undefined,false,false ion-alert,prop,subHeader,string | undefined,undefined,false,false ion-alert,prop,translucent,boolean,false,false,false ion-alert,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise -ion-alert,method,onDidDismiss,onDidDismiss() => Promise> -ion-alert,method,onWillDismiss,onWillDismiss() => Promise> +ion-alert,method,onDidDismiss,onDidDismiss() => Promise> +ion-alert,method,onWillDismiss,onWillDismiss() => Promise> ion-alert,method,present,present() => Promise ion-alert,event,ionAlertDidDismiss,OverlayEventDetail,true ion-alert,event,ionAlertDidPresent,void,true @@ -612,8 +612,8 @@ ion-loading,prop,showBackdrop,boolean,true,false,false ion-loading,prop,spinner,"bubbles" | "circles" | "circular" | "crescent" | "dots" | "lines" | "lines-small" | null | undefined,undefined,false,false ion-loading,prop,translucent,boolean,false,false,false ion-loading,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise -ion-loading,method,onDidDismiss,onDidDismiss() => Promise> -ion-loading,method,onWillDismiss,onWillDismiss() => Promise> +ion-loading,method,onDidDismiss,onDidDismiss() => Promise> +ion-loading,method,onWillDismiss,onWillDismiss() => Promise> ion-loading,method,present,present() => Promise ion-loading,event,ionLoadingDidDismiss,OverlayEventDetail,true ion-loading,event,ionLoadingDidPresent,void,true @@ -695,8 +695,8 @@ ion-modal,prop,presentingElement,HTMLElement | undefined,undefined,false,false ion-modal,prop,showBackdrop,boolean,true,false,false ion-modal,prop,swipeToClose,boolean,false,false,false ion-modal,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise -ion-modal,method,onDidDismiss,onDidDismiss() => Promise> -ion-modal,method,onWillDismiss,onWillDismiss() => Promise> +ion-modal,method,onDidDismiss,onDidDismiss() => Promise> +ion-modal,method,onWillDismiss,onWillDismiss() => Promise> ion-modal,method,present,present() => Promise ion-modal,event,ionModalDidDismiss,OverlayEventDetail,true ion-modal,event,ionModalDidPresent,void,true @@ -761,8 +761,8 @@ ion-picker,prop,mode,"ios" | "md",undefined,false,false ion-picker,prop,showBackdrop,boolean,true,false,false ion-picker,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise ion-picker,method,getColumn,getColumn(name: string) => Promise -ion-picker,method,onDidDismiss,onDidDismiss() => Promise> -ion-picker,method,onWillDismiss,onWillDismiss() => Promise> +ion-picker,method,onDidDismiss,onDidDismiss() => Promise> +ion-picker,method,onWillDismiss,onWillDismiss() => Promise> ion-picker,method,present,present() => Promise ion-picker,event,ionPickerDidDismiss,OverlayEventDetail,true ion-picker,event,ionPickerDidPresent,void,true @@ -796,8 +796,8 @@ ion-popover,prop,mode,"ios" | "md",undefined,false,false ion-popover,prop,showBackdrop,boolean,true,false,false ion-popover,prop,translucent,boolean,false,false,false ion-popover,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise -ion-popover,method,onDidDismiss,onDidDismiss() => Promise> -ion-popover,method,onWillDismiss,onWillDismiss() => Promise> +ion-popover,method,onDidDismiss,onDidDismiss() => Promise> +ion-popover,method,onWillDismiss,onWillDismiss() => Promise> ion-popover,method,present,present() => Promise ion-popover,event,ionPopoverDidDismiss,OverlayEventDetail,true ion-popover,event,ionPopoverDidPresent,void,true @@ -1242,8 +1242,8 @@ ion-toast,prop,mode,"ios" | "md",undefined,false,false ion-toast,prop,position,"bottom" | "middle" | "top",'bottom',false,false ion-toast,prop,translucent,boolean,false,false,false ion-toast,method,dismiss,dismiss(data?: any, role?: string | undefined) => Promise -ion-toast,method,onDidDismiss,onDidDismiss() => Promise> -ion-toast,method,onWillDismiss,onWillDismiss() => Promise> +ion-toast,method,onDidDismiss,onDidDismiss() => Promise> +ion-toast,method,onWillDismiss,onWillDismiss() => Promise> ion-toast,method,present,present() => Promise ion-toast,event,ionToastDidDismiss,OverlayEventDetail,true ion-toast,event,ionToastDidPresent,void,true diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 9ed40f58ef..4ddbacb283 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -55,11 +55,11 @@ export namespace Components { /** * Returns a promise that resolves when the action sheet did dismiss. */ - "onDidDismiss": () => Promise>; + "onDidDismiss": () => Promise>; /** * Returns a promise that resolves when the action sheet will dismiss. */ - "onWillDismiss": () => Promise>; + "onWillDismiss": () => Promise>; "overlayIndex": number; /** * Present the action sheet overlay after it has been created. @@ -128,11 +128,11 @@ export namespace Components { /** * Returns a promise that resolves when the alert did dismiss. */ - "onDidDismiss": () => Promise>; + "onDidDismiss": () => Promise>; /** * Returns a promise that resolves when the alert will dismiss. */ - "onWillDismiss": () => Promise>; + "onWillDismiss": () => Promise>; "overlayIndex": number; /** * Present the alert overlay after it has been created. @@ -1159,11 +1159,11 @@ export namespace Components { /** * Returns a promise that resolves when the loading did dismiss. */ - "onDidDismiss": () => Promise>; + "onDidDismiss": () => Promise>; /** * Returns a promise that resolves when the loading will dismiss. */ - "onWillDismiss": () => Promise>; + "onWillDismiss": () => Promise>; "overlayIndex": number; /** * Present the loading overlay after it has been created. @@ -1315,11 +1315,11 @@ export namespace Components { /** * Returns a promise that resolves when the modal did dismiss. */ - "onDidDismiss": () => Promise>; + "onDidDismiss": () => Promise>; /** * Returns a promise that resolves when the modal will dismiss. */ - "onWillDismiss": () => Promise>; + "onWillDismiss": () => Promise>; "overlayIndex": number; /** * Present the modal overlay after it has been created. @@ -1528,11 +1528,11 @@ export namespace Components { /** * Returns a promise that resolves when the picker did dismiss. */ - "onDidDismiss": () => Promise>; + "onDidDismiss": () => Promise>; /** * Returns a promise that resolves when the picker will dismiss. */ - "onWillDismiss": () => Promise>; + "onWillDismiss": () => Promise>; "overlayIndex": number; /** * Present the picker overlay after it has been created. @@ -1600,11 +1600,11 @@ export namespace Components { /** * Returns a promise that resolves when the popover did dismiss. */ - "onDidDismiss": () => Promise>; + "onDidDismiss": () => Promise>; /** * Returns a promise that resolves when the popover will dismiss. */ - "onWillDismiss": () => Promise>; + "onWillDismiss": () => Promise>; "overlayIndex": number; /** * Present the popover overlay after it has been created. @@ -2510,11 +2510,11 @@ export namespace Components { /** * Returns a promise that resolves when the toast did dismiss. */ - "onDidDismiss": () => Promise>; + "onDidDismiss": () => Promise>; /** * Returns a promise that resolves when the toast will dismiss. */ - "onWillDismiss": () => Promise>; + "onWillDismiss": () => Promise>; "overlayIndex": number; /** * The position of the toast on the screen. diff --git a/core/src/components/action-sheet/action-sheet.tsx b/core/src/components/action-sheet/action-sheet.tsx index 6c2b132b94..38e67459b1 100644 --- a/core/src/components/action-sheet/action-sheet.tsx +++ b/core/src/components/action-sheet/action-sheet.tsx @@ -139,7 +139,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface { * Returns a promise that resolves when the action sheet did dismiss. */ @Method() - onDidDismiss(): Promise { + onDidDismiss(): Promise> { return eventMethod(this.el, 'ionActionSheetDidDismiss'); } @@ -148,7 +148,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface { * */ @Method() - onWillDismiss(): Promise { + onWillDismiss(): Promise> { return eventMethod(this.el, 'ionActionSheetWillDismiss'); } diff --git a/core/src/components/action-sheet/readme.md b/core/src/components/action-sheet/readme.md index ff90435414..62988a68ef 100644 --- a/core/src/components/action-sheet/readme.md +++ b/core/src/components/action-sheet/readme.md @@ -381,23 +381,23 @@ Type: `Promise` -### `onDidDismiss() => Promise>` +### `onDidDismiss() => Promise>` Returns a promise that resolves when the action sheet did dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` -### `onWillDismiss() => Promise>` +### `onWillDismiss() => Promise>` Returns a promise that resolves when the action sheet will dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` diff --git a/core/src/components/alert/alert.tsx b/core/src/components/alert/alert.tsx index 6eb8b88818..5c6ddaee2c 100644 --- a/core/src/components/alert/alert.tsx +++ b/core/src/components/alert/alert.tsx @@ -225,7 +225,7 @@ export class Alert implements ComponentInterface, OverlayInterface { * Returns a promise that resolves when the alert did dismiss. */ @Method() - onDidDismiss(): Promise { + onDidDismiss(): Promise> { return eventMethod(this.el, 'ionAlertDidDismiss'); } @@ -233,7 +233,7 @@ export class Alert implements ComponentInterface, OverlayInterface { * Returns a promise that resolves when the alert will dismiss. */ @Method() - onWillDismiss(): Promise { + onWillDismiss(): Promise> { return eventMethod(this.el, 'ionAlertWillDismiss'); } diff --git a/core/src/components/alert/readme.md b/core/src/components/alert/readme.md index f31d8156f8..c76f62853c 100644 --- a/core/src/components/alert/readme.md +++ b/core/src/components/alert/readme.md @@ -1460,23 +1460,23 @@ Type: `Promise` -### `onDidDismiss() => Promise>` +### `onDidDismiss() => Promise>` Returns a promise that resolves when the alert did dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` -### `onWillDismiss() => Promise>` +### `onWillDismiss() => Promise>` Returns a promise that resolves when the alert will dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` diff --git a/core/src/components/loading/loading.tsx b/core/src/components/loading/loading.tsx index 2c11c7233e..536d97341c 100644 --- a/core/src/components/loading/loading.tsx +++ b/core/src/components/loading/loading.tsx @@ -161,7 +161,7 @@ export class Loading implements ComponentInterface, OverlayInterface { * Returns a promise that resolves when the loading did dismiss. */ @Method() - onDidDismiss(): Promise { + onDidDismiss(): Promise> { return eventMethod(this.el, 'ionLoadingDidDismiss'); } @@ -169,7 +169,7 @@ export class Loading implements ComponentInterface, OverlayInterface { * Returns a promise that resolves when the loading will dismiss. */ @Method() - onWillDismiss(): Promise { + onWillDismiss(): Promise> { return eventMethod(this.el, 'ionLoadingWillDismiss'); } diff --git a/core/src/components/loading/readme.md b/core/src/components/loading/readme.md index a02ec87c58..58faecb2d4 100644 --- a/core/src/components/loading/readme.md +++ b/core/src/components/loading/readme.md @@ -307,23 +307,23 @@ Type: `Promise` -### `onDidDismiss() => Promise>` +### `onDidDismiss() => Promise>` Returns a promise that resolves when the loading did dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` -### `onWillDismiss() => Promise>` +### `onWillDismiss() => Promise>` Returns a promise that resolves when the loading will dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` diff --git a/core/src/components/modal/modal.tsx b/core/src/components/modal/modal.tsx index 6907b262e5..0ef2eacb0a 100644 --- a/core/src/components/modal/modal.tsx +++ b/core/src/components/modal/modal.tsx @@ -227,7 +227,7 @@ export class Modal implements ComponentInterface, OverlayInterface { * Returns a promise that resolves when the modal did dismiss. */ @Method() - onDidDismiss(): Promise { + onDidDismiss(): Promise> { return eventMethod(this.el, 'ionModalDidDismiss'); } @@ -235,7 +235,7 @@ export class Modal implements ComponentInterface, OverlayInterface { * Returns a promise that resolves when the modal will dismiss. */ @Method() - onWillDismiss(): Promise { + onWillDismiss(): Promise> { return eventMethod(this.el, 'ionModalWillDismiss'); } diff --git a/core/src/components/modal/readme.md b/core/src/components/modal/readme.md index 47b89200c2..8f8564731d 100644 --- a/core/src/components/modal/readme.md +++ b/core/src/components/modal/readme.md @@ -644,23 +644,23 @@ Type: `Promise` -### `onDidDismiss() => Promise>` +### `onDidDismiss() => Promise>` Returns a promise that resolves when the modal did dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` -### `onWillDismiss() => Promise>` +### `onWillDismiss() => Promise>` Returns a promise that resolves when the modal will dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` diff --git a/core/src/components/picker/picker.tsx b/core/src/components/picker/picker.tsx index 5ff5435c5d..cb793c887d 100644 --- a/core/src/components/picker/picker.tsx +++ b/core/src/components/picker/picker.tsx @@ -137,7 +137,7 @@ export class Picker implements ComponentInterface, OverlayInterface { * Returns a promise that resolves when the picker did dismiss. */ @Method() - onDidDismiss(): Promise { + onDidDismiss(): Promise> { return eventMethod(this.el, 'ionPickerDidDismiss'); } @@ -145,7 +145,7 @@ export class Picker implements ComponentInterface, OverlayInterface { * Returns a promise that resolves when the picker will dismiss. */ @Method() - onWillDismiss(): Promise { + onWillDismiss(): Promise> { return eventMethod(this.el, 'ionPickerWillDismiss'); } diff --git a/core/src/components/picker/readme.md b/core/src/components/picker/readme.md index 392c6dbbb3..0e7513a954 100644 --- a/core/src/components/picker/readme.md +++ b/core/src/components/picker/readme.md @@ -56,23 +56,23 @@ Type: `Promise` -### `onDidDismiss() => Promise>` +### `onDidDismiss() => Promise>` Returns a promise that resolves when the picker did dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` -### `onWillDismiss() => Promise>` +### `onWillDismiss() => Promise>` Returns a promise that resolves when the picker will dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` diff --git a/core/src/components/popover/popover.tsx b/core/src/components/popover/popover.tsx index bda5f4628b..f658cc74e0 100644 --- a/core/src/components/popover/popover.tsx +++ b/core/src/components/popover/popover.tsx @@ -159,7 +159,7 @@ export class Popover implements ComponentInterface, OverlayInterface { * Returns a promise that resolves when the popover did dismiss. */ @Method() - onDidDismiss(): Promise { + onDidDismiss(): Promise> { return eventMethod(this.el, 'ionPopoverDidDismiss'); } @@ -167,7 +167,7 @@ export class Popover implements ComponentInterface, OverlayInterface { * Returns a promise that resolves when the popover will dismiss. */ @Method() - onWillDismiss(): Promise { + onWillDismiss(): Promise> { return eventMethod(this.el, 'ionPopoverWillDismiss'); } diff --git a/core/src/components/popover/readme.md b/core/src/components/popover/readme.md index dfa88dc641..115786ccc0 100644 --- a/core/src/components/popover/readme.md +++ b/core/src/components/popover/readme.md @@ -214,23 +214,23 @@ Type: `Promise` -### `onDidDismiss() => Promise>` +### `onDidDismiss() => Promise>` Returns a promise that resolves when the popover did dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` -### `onWillDismiss() => Promise>` +### `onWillDismiss() => Promise>` Returns a promise that resolves when the popover will dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` diff --git a/core/src/components/toast/readme.md b/core/src/components/toast/readme.md index 4cf57087d7..b32869dd30 100644 --- a/core/src/components/toast/readme.md +++ b/core/src/components/toast/readme.md @@ -257,23 +257,23 @@ Type: `Promise` -### `onDidDismiss() => Promise>` +### `onDidDismiss() => Promise>` Returns a promise that resolves when the toast did dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` -### `onWillDismiss() => Promise>` +### `onWillDismiss() => Promise>` Returns a promise that resolves when the toast will dismiss. #### Returns -Type: `Promise>` +Type: `Promise>` diff --git a/core/src/components/toast/toast.tsx b/core/src/components/toast/toast.tsx index df60289c65..0fa8b86f5b 100644 --- a/core/src/components/toast/toast.tsx +++ b/core/src/components/toast/toast.tsx @@ -158,7 +158,7 @@ export class Toast implements ComponentInterface, OverlayInterface { * Returns a promise that resolves when the toast did dismiss. */ @Method() - onDidDismiss(): Promise { + onDidDismiss(): Promise> { return eventMethod(this.el, 'ionToastDidDismiss'); } @@ -166,7 +166,7 @@ export class Toast implements ComponentInterface, OverlayInterface { * Returns a promise that resolves when the toast will dismiss. */ @Method() - onWillDismiss(): Promise { + onWillDismiss(): Promise> { return eventMethod(this.el, 'ionToastWillDismiss'); }