refactor(overlay): using TS 2.8 utils

This commit is contained in:
Manu Mtz.-Almeida
2018-05-14 13:20:20 +02:00
parent af5db2fb02
commit 87fe5ce3a8
4 changed files with 14 additions and 9 deletions

View File

@ -358,6 +358,7 @@ declare global {
* The main message to be displayed in the alert. * The main message to be displayed in the alert.
*/ */
'message': string; 'message': string;
'mode': Mode;
/** /**
* Returns a promise that resolves when the alert did dismiss. It also accepts a callback that is called in the same circustances. ``` const {data, role} = await alert.onDidDismiss(); ``` * Returns a promise that resolves when the alert did dismiss. It also accepts a callback that is called in the same circustances. ``` const {data, role} = await alert.onDidDismiss(); ```
*/ */
@ -438,6 +439,7 @@ declare global {
* The main message to be displayed in the alert. * The main message to be displayed in the alert.
*/ */
'message'?: string; 'message'?: string;
'mode'?: Mode;
/** /**
* Emitted after the alert has dismissed. * Emitted after the alert has dismissed.
*/ */

View File

@ -28,7 +28,7 @@ export class Alert implements OverlayInterface {
animation?: Animation; animation?: Animation;
color!: string; color!: string;
mode!: Mode; @Prop() mode!: Mode;
@Element() el!: HTMLStencilElement; @Element() el!: HTMLStencilElement;

View File

@ -87,6 +87,11 @@ string
The main message to be displayed in the alert. The main message to be displayed in the alert.
#### mode
string
#### overlayId #### overlayId
number number
@ -177,6 +182,11 @@ string
The main message to be displayed in the alert. The main message to be displayed in the alert.
#### mode
string
#### overlay-id #### overlay-id
number number

View File

@ -3,14 +3,7 @@ import { Animation, AnimationBuilder, Config, Mode } from '../interface';
let lastId = 1; let lastId = 1;
/** export function createOverlay<T extends HTMLIonOverlayElement & Required<B>, B>
* Convert an interface where all the properties are optional to mandatory.
*/
export type Requires<K extends string> = {
[P in K]: any;
};
export function createOverlay<T extends HTMLIonOverlayElement & Requires<keyof B>, B>
(element: T, opts: B): Promise<T> { (element: T, opts: B): Promise<T> {
// convert the passed in overlay options into props // convert the passed in overlay options into props
// that get passed down into the new overlay // that get passed down into the new overlay