Skip to content

Commit

Permalink
refactor(overlay): using TS 2.8 utils
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed May 14, 2018
1 parent af5db2f commit 87fe5ce
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 2 additions & 0 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(); ```
*/
Expand Down Expand Up @@ -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.
*/
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class Alert implements OverlayInterface {
animation?: Animation;

color!: string;
mode!: Mode;
@Prop() mode!: Mode;

@Element() el!: HTMLStencilElement;

Expand Down
10 changes: 10 additions & 0 deletions core/src/components/alert/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ string
The main message to be displayed in the alert.


#### mode

string


#### overlayId

number
Expand Down Expand Up @@ -177,6 +182,11 @@ string
The main message to be displayed in the alert.


#### mode

string


#### overlay-id

number
Expand Down
9 changes: 1 addition & 8 deletions core/src/utils/overlays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<K extends string> = {
[P in K]: any;
};

export function createOverlay<T extends HTMLIonOverlayElement & Requires<keyof B>, B>
export function createOverlay<T extends HTMLIonOverlayElement & Required<B>, B>
(element: T, opts: B): Promise<T> {
// convert the passed in overlay options into props
// that get passed down into the new overlay
Expand Down

0 comments on commit 87fe5ce

Please sign in to comment.