diff --git a/src/lib/toastr/toast.component.ts b/src/lib/toastr/toast.component.ts index deeb05d4..6f2e6e73 100644 --- a/src/lib/toastr/toast.component.ts +++ b/src/lib/toastr/toast.component.ts @@ -53,10 +53,10 @@ import { ToastrService } from './toastr.service'; ], preserveWhitespaces: false }) -export class Toast implements OnDestroy { +export class Toast implements OnDestroy { message?: string | null; title?: string; - options: IndividualConfig; + options: IndividualConfig; duplicatesCount!: number; originalTimeout: number; /** width of progress bar */ diff --git a/src/lib/toastr/toastr-config.ts b/src/lib/toastr/toastr-config.ts index f2b3a3e0..0f7df668 100644 --- a/src/lib/toastr/toastr-config.ts +++ b/src/lib/toastr/toastr-config.ts @@ -11,7 +11,7 @@ export type DisableTimoutType = boolean | 'timeOut' | 'extendedTimeOut'; /** * Configuration for an individual toast. */ -export interface IndividualConfig { +export interface IndividualConfig { /** * disable both timeOut and extendedTimeOut * default: false @@ -101,10 +101,9 @@ export interface IndividualConfig { newestOnTop: boolean; /** - * payload to pass to the toastComponent - * default: null + * Payload to pass to the toast component */ - payload: any; + payload?: ConfigPayload; } export interface ToastrIconClasses { @@ -157,13 +156,13 @@ export interface GlobalConfig extends IndividualConfig { /** * Everything a toast needs to launch */ -export class ToastPackage { +export class ToastPackage { private _onTap = new Subject(); private _onAction = new Subject(); constructor( public toastId: number, - public config: IndividualConfig, + public config: IndividualConfig, public message: string | null | undefined, public title: string | undefined, public toastType: string, @@ -237,8 +236,6 @@ export const DefaultNoComponentGlobalConfig: GlobalConfig = { tapToDismiss: true, onActivateTick: false, progressAnimation: 'decreasing', - - payload: null }; export interface ToastToken { diff --git a/src/lib/toastr/toastr.service.ts b/src/lib/toastr/toastr.service.ts index 88ac16ff..e15826c4 100644 --- a/src/lib/toastr/toastr.service.ts +++ b/src/lib/toastr/toastr.service.ts @@ -64,26 +64,26 @@ export class ToastrService { } } /** show toast */ - show(message?: string, title?: string, override: Partial = {}, type = '') { + show(message?: string, title?: string, override: Partial> = {}, type = '') { return this._preBuildNotification(type, message, title, this.applyConfig(override)); } /** show successful toast */ - success(message?: string, title?: string, override: Partial = {}) { + success(message?: string, title?: string, override: Partial> = {}) { const type = this.toastrConfig.iconClasses.success || ''; return this._preBuildNotification(type, message, title, this.applyConfig(override)); } /** show error toast */ - error(message?: string, title?: string, override: Partial = {}) { + error(message?: string, title?: string, override: Partial> = {}) { const type = this.toastrConfig.iconClasses.error || ''; return this._preBuildNotification(type, message, title, this.applyConfig(override)); } /** show info toast */ - info(message?: string, title?: string, override: Partial = {}) { + info(message?: string, title?: string, override: Partial> = {}) { const type = this.toastrConfig.iconClasses.info || ''; return this._preBuildNotification(type, message, title, this.applyConfig(override)); } /** show warning toast */ - warning(message?: string, title?: string, override: Partial = {}) { + warning(message?: string, title?: string, override: Partial> = {}) { const type = this.toastrConfig.iconClasses.warning || ''; return this._preBuildNotification(type, message, title, this.applyConfig(override)); }