Skip to content

Commit

Permalink
fix(toast): types
Browse files Browse the repository at this point in the history
  • Loading branch information
xidedix committed Jan 2, 2024
1 parent 735f5ed commit 4687442
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions projects/coreui-angular/src/lib/toast/toast/toast.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class ToastComponent implements OnInit, OnDestroy {
* Auto hide the toast.
* @type boolean
*/
@Input() autohide = true;
@Input() autohide: boolean = true;

/**
* Sets the color context of the component to one of CoreUI’s themed colors.
Expand All @@ -79,13 +79,13 @@ export class ToastComponent implements OnInit, OnDestroy {
* Delay hiding the toast (ms).
* @type number
*/
@Input() delay = 5000;
@Input() delay: number = 5000;

/**
* Apply fade transition to the toast.
* @type boolean
*/
@Input() fade = true;
@Input() fade: boolean = true;

/**
* Toggle the visibility of component.
Expand Down Expand Up @@ -115,19 +115,19 @@ export class ToastComponent implements OnInit, OnDestroy {

/**
* Event emitted on visibility change. [docs]
* @type boolean
* @type EventEmitter<boolean>
*/
@Output() visibleChange = new EventEmitter<boolean>();
@Output() visibleChange: EventEmitter<boolean> = new EventEmitter<boolean>();

/**
* Event emitted on timer tick. [docs]
* @type number
*/
@Output() timer: EventEmitter<number> = new EventEmitter();

private timerId: any;
private clockId: any;
private clockTimerId: any;
private timerId: ReturnType<typeof setTimeout> | undefined;
private clockId: ReturnType<typeof setInterval> | undefined;
private clockTimerId: ReturnType<typeof setTimeout> | undefined;

private _clock!: number;

Expand Down Expand Up @@ -188,15 +188,15 @@ export class ToastComponent implements OnInit, OnDestroy {
setTimer(): void {
this.clearTimer();
if (this.autohide && this.visible) {
this.timerId = this.delay > 0 ? setTimeout(() => this.onClose(), this.delay) : null;
this.timerId = this.delay > 0 ? setTimeout(() => this.onClose(), this.delay) : undefined;
this.setClock();
}
}

clearTimer(): void {
this.clearClock();
clearTimeout(this.timerId);
this.timerId = null;
this.timerId = undefined;
}

onClose(): void {
Expand All @@ -223,6 +223,6 @@ export class ToastComponent implements OnInit, OnDestroy {
clearClock(): void {
clearTimeout(this.clockTimerId);
clearInterval(this.clockId);
this.clockId = null;
this.clockId = undefined;
}
}

0 comments on commit 4687442

Please sign in to comment.