Skip to content

Commit 25ddc68

Browse files
committed
toaster fixup
1 parent a23bb6f commit 25ddc68

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

addon/services/toaster.ts

+13-3
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,26 @@ import { A, type NativeArray } from '@ember/array';
55
import type { ComponentLike } from '@glint/template';
66

77
export type ToastData = {
8-
component?: ComponentLike;
8+
component?: ComponentLike<CustomToastSignature>;
99
title?: string;
1010
message?: string;
1111
options: ToastOptions;
1212
};
1313

1414
export type ToastOptions = {
15-
icon?: string | ComponentLike;
15+
icon?: string | ComponentLike<{ Element: Element }>;
1616
closable?: boolean;
1717
timeOut?: number | null;
1818
type?: 'error' | 'success' | 'warning';
1919
};
2020

21+
export interface CustomToastSignature {
22+
Args: {
23+
options: ToastOptions;
24+
close: () => void;
25+
};
26+
}
27+
2128
export default class ToasterService extends Service {
2229
// TS was complaining without the explicit NativeArray import and type here, not sure why.
2330
// TODO: Replace A with a regular array
@@ -41,7 +48,10 @@ export default class ToasterService extends Service {
4148
}
4249
});
4350

44-
show(component: ComponentLike, options: ToastOptions = {}) {
51+
show(
52+
component: ComponentLike<CustomToastSignature>,
53+
options: ToastOptions = {},
54+
) {
4555
const toast = {
4656
component,
4757
options,

0 commit comments

Comments
 (0)