File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -5,19 +5,26 @@ import { A, type NativeArray } from '@ember/array';
5
5
import type { ComponentLike } from '@glint/template' ;
6
6
7
7
export type ToastData = {
8
- component ?: ComponentLike ;
8
+ component ?: ComponentLike < CustomToastSignature > ;
9
9
title ?: string ;
10
10
message ?: string ;
11
11
options : ToastOptions ;
12
12
} ;
13
13
14
14
export type ToastOptions = {
15
- icon ?: string | ComponentLike ;
15
+ icon ?: string | ComponentLike < { Element : Element } > ;
16
16
closable ?: boolean ;
17
17
timeOut ?: number | null ;
18
18
type ?: 'error' | 'success' | 'warning' ;
19
19
} ;
20
20
21
+ export interface CustomToastSignature {
22
+ Args : {
23
+ options : ToastOptions ;
24
+ close : ( ) => void ;
25
+ } ;
26
+ }
27
+
21
28
export default class ToasterService extends Service {
22
29
// TS was complaining without the explicit NativeArray import and type here, not sure why.
23
30
// TODO: Replace A with a regular array
@@ -41,7 +48,10 @@ export default class ToasterService extends Service {
41
48
}
42
49
} ) ;
43
50
44
- show ( component : ComponentLike , options : ToastOptions = { } ) {
51
+ show (
52
+ component : ComponentLike < CustomToastSignature > ,
53
+ options : ToastOptions = { } ,
54
+ ) {
45
55
const toast = {
46
56
component,
47
57
options,
You can’t perform that action at this time.
0 commit comments