From 87fe5ce3a8fa65b83d798818f96d5f01781ac3e6 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Mon, 14 May 2018 13:20:20 +0200 Subject: [PATCH] refactor(overlay): using TS 2.8 utils --- core/src/components.d.ts | 2 ++ core/src/components/alert/alert.tsx | 2 +- core/src/components/alert/readme.md | 10 ++++++++++ core/src/utils/overlays.ts | 9 +-------- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/core/src/components.d.ts b/core/src/components.d.ts index d15e86fcad..0a7057c47f 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -358,6 +358,7 @@ declare global { * The main message to be displayed in the alert. */ '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(); ``` */ @@ -438,6 +439,7 @@ declare global { * The main message to be displayed in the alert. */ 'message'?: string; + 'mode'?: Mode; /** * Emitted after the alert has dismissed. */ diff --git a/core/src/components/alert/alert.tsx b/core/src/components/alert/alert.tsx index 90d69791df..cdf44312e8 100644 --- a/core/src/components/alert/alert.tsx +++ b/core/src/components/alert/alert.tsx @@ -28,7 +28,7 @@ export class Alert implements OverlayInterface { animation?: Animation; color!: string; - mode!: Mode; + @Prop() mode!: Mode; @Element() el!: HTMLStencilElement; diff --git a/core/src/components/alert/readme.md b/core/src/components/alert/readme.md index e7e1fb05f3..091a6610a0 100644 --- a/core/src/components/alert/readme.md +++ b/core/src/components/alert/readme.md @@ -87,6 +87,11 @@ string The main message to be displayed in the alert. +#### mode + +string + + #### overlayId number @@ -177,6 +182,11 @@ string The main message to be displayed in the alert. +#### mode + +string + + #### overlay-id number diff --git a/core/src/utils/overlays.ts b/core/src/utils/overlays.ts index d91f1d9745..29fff9231b 100644 --- a/core/src/utils/overlays.ts +++ b/core/src/utils/overlays.ts @@ -3,14 +3,7 @@ import { Animation, AnimationBuilder, Config, Mode } from '../interface'; let lastId = 1; -/** - * Convert an interface where all the properties are optional to mandatory. - */ -export type Requires = { - [P in K]: any; -}; - -export function createOverlay, B> +export function createOverlay, B> (element: T, opts: B): Promise { // convert the passed in overlay options into props // that get passed down into the new overlay