Skip to content

Commit

Permalink
Merge pull request #13080 from Menecats/fix/13079
Browse files Browse the repository at this point in the history
Fix #13079 - Wrong type definition of ToastCloseEvent
  • Loading branch information
gucal authored May 23, 2023
2 parents 04a7f36 + 0ede135 commit 9a180b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
7 changes: 2 additions & 5 deletions src/app/components/toast/toast.interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TemplateRef } from '@angular/core';
import { Toast } from './toast';
import { Message } from '../api/message';
/**
* Breakpoints of toast element.
*/
Expand Down Expand Up @@ -33,9 +34,5 @@ export interface ToastCloseEvent {
/**
* Message of the closed element.
*/
message?: string;
/**
* Index of the removed element.
*/
index?: number;
message: Message;
}
8 changes: 4 additions & 4 deletions src/app/components/toast/toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ import { ToastBreakpoints, ToastCloseEvent } from './toast.interface';
}
})
export class ToastItem implements AfterViewInit, OnDestroy {
@Input() message: Message | null | undefined;
@Input({required: true}) message!: Message;

@Input() index: number | undefined;
@Input({required: true}) index!: number;

@Input() template: TemplateRef<any> | undefined;

Expand All @@ -112,7 +112,7 @@ export class ToastItem implements AfterViewInit, OnDestroy {

@Input() hideTransitionOptions: string | undefined;

@Output() onClose: EventEmitter<object> = new EventEmitter();
@Output() onClose: EventEmitter<{message: Message, index: number}> = new EventEmitter();

@ViewChild('container') containerViewChild: ElementRef | undefined;

Expand Down Expand Up @@ -370,7 +370,7 @@ export class Toast implements OnInit, AfterContentInit, OnDestroy {
});
}

onMessageClose(event: any) {
onMessageClose(event: {message: Message, index: number}) {
this.messages?.splice(event.index, 1);

this.onClose.emit({
Expand Down

1 comment on commit 9a180b4

@vercel
Copy link

@vercel vercel bot commented on 9a180b4 May 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.