Skip to content

Commit

Permalink
Merge pull request #149 from andrewpmontgomery/master
Browse files Browse the repository at this point in the history
Fix Angular CLI build with index signatures
  • Loading branch information
Stabzs committed Mar 8, 2018
2 parents aa206c5 + b52afe9 commit 3389412
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {BodyOutputType} from './bodyOutputType';
import {ToasterConfig} from './toaster-config';

export interface Toast {
type: string;
type: ToastType;
title?: string;
body?: any;
toastId?: string;
Expand All @@ -18,5 +18,6 @@ export interface Toast {
data?: any;
}

export type ToastType = 'info' | 'wait' | 'warning' | 'success' | 'error' | string;
export type ClickHandler = (toast: Toast, isCloseButton?: boolean) => boolean;
export type OnActionCallback = (toast: Toast) => void;
9 changes: 5 additions & 4 deletions src/toaster-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {BodyOutputType} from './bodyOutputType';
import {ToastType} from './toast';

export interface IToasterConfig {
limit?: number|null;
Expand All @@ -7,8 +8,8 @@ export interface IToasterConfig {
closeHtml?: string;
newestOnTop?: boolean;
timeout?: number|Object;
typeClasses?: Object;
iconClasses?: Object;
typeClasses?: { [key: ToastType]: string };
iconClasses?: { [key: ToastType]: string };
bodyOutputType?: BodyOutputType;
bodyTemplate?: string;
defaultTypeClass?: string;
Expand All @@ -32,8 +33,8 @@ export class ToasterConfig implements IToasterConfig {
closeHtml: string;
newestOnTop: boolean;
timeout: number|Object;
typeClasses: Object;
iconClasses: Object;
typeClasses: { [key: ToastType]: string };
iconClasses: { [key: ToastType]: string };
bodyOutputType: BodyOutputType;
bodyTemplate: string;
defaultTypeClass: string;
Expand Down
10 changes: 5 additions & 5 deletions src/toaster.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Injectable} from '@angular/core';
import {Toast} from './toast';
import {Toast, ToastType} from './toast';
import {IClearWrapper} from './clearWrapper';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/operator/share';
Expand Down Expand Up @@ -41,13 +41,13 @@ export class ToasterService {
/**
* Synchronously create and show a new toast instance.
*
* @param {(string | Toast)} type The type of the toast, or a Toast object.
* @param {(string | Toast)} type The type of the toast (error/info/wait/success/warning), or a Toast object.
* @param {string=} title The toast title.
* @param {string=} body The toast body.
* @returns {Toast}
* The newly created Toast instance with a randomly generated GUID Id.
*/
pop(type: string | Toast, title?: string, body?: string): Toast {
pop(type: ToastType | Toast, title?: string, body?: string): Toast {
const toast = typeof type === 'string' ? { type: type, title: title, body: body } : type;

toast.toastId = Guid.newGuid();
Expand All @@ -63,14 +63,14 @@ export class ToasterService {
/**
* Asynchronously create and show a new toast instance.
*
* @param {(string | Toast)} type The type of the toast, or a Toast object.
* @param {(string | Toast)} type The type of the toast (error/info/wait/success/warning), or a Toast object.
* @param {string=} title The toast title.
* @param {string=} body The toast body.
* @returns {Observable<Toast>}
* A hot Observable that can be subscribed to in order to receive the Toast instance
* with a randomly generated GUID Id.
*/
popAsync(type: string | Toast, title?: string, body?: string): Observable<Toast> {
popAsync(type: ToastType | Toast, title?: string, body?: string): Observable<Toast> {
setTimeout(() => {
this.pop(type, title, body);
}, 0);
Expand Down

0 comments on commit 3389412

Please sign in to comment.