Skip to content

Commit 4687442

Browse files
committed
fix(toast): types
1 parent 735f5ed commit 4687442

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

projects/coreui-angular/src/lib/toast/toast/toast.component.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class ToastComponent implements OnInit, OnDestroy {
6767
* Auto hide the toast.
6868
* @type boolean
6969
*/
70-
@Input() autohide = true;
70+
@Input() autohide: boolean = true;
7171

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

8484
/**
8585
* Apply fade transition to the toast.
8686
* @type boolean
8787
*/
88-
@Input() fade = true;
88+
@Input() fade: boolean = true;
8989

9090
/**
9191
* Toggle the visibility of component.
@@ -115,19 +115,19 @@ export class ToastComponent implements OnInit, OnDestroy {
115115

116116
/**
117117
* Event emitted on visibility change. [docs]
118-
* @type boolean
118+
* @type EventEmitter<boolean>
119119
*/
120-
@Output() visibleChange = new EventEmitter<boolean>();
120+
@Output() visibleChange: EventEmitter<boolean> = new EventEmitter<boolean>();
121121

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

128-
private timerId: any;
129-
private clockId: any;
130-
private clockTimerId: any;
128+
private timerId: ReturnType<typeof setTimeout> | undefined;
129+
private clockId: ReturnType<typeof setInterval> | undefined;
130+
private clockTimerId: ReturnType<typeof setTimeout> | undefined;
131131

132132
private _clock!: number;
133133

@@ -188,15 +188,15 @@ export class ToastComponent implements OnInit, OnDestroy {
188188
setTimer(): void {
189189
this.clearTimer();
190190
if (this.autohide && this.visible) {
191-
this.timerId = this.delay > 0 ? setTimeout(() => this.onClose(), this.delay) : null;
191+
this.timerId = this.delay > 0 ? setTimeout(() => this.onClose(), this.delay) : undefined;
192192
this.setClock();
193193
}
194194
}
195195

196196
clearTimer(): void {
197197
this.clearClock();
198198
clearTimeout(this.timerId);
199-
this.timerId = null;
199+
this.timerId = undefined;
200200
}
201201

202202
onClose(): void {
@@ -223,6 +223,6 @@ export class ToastComponent implements OnInit, OnDestroy {
223223
clearClock(): void {
224224
clearTimeout(this.clockTimerId);
225225
clearInterval(this.clockId);
226-
this.clockId = null;
226+
this.clockId = undefined;
227227
}
228228
}

0 commit comments

Comments
 (0)