Skip to content

Commit 49de067

Browse files
committed
some more poking
The show method options aren't the same as the "ToastOptions" it's simple any object that the consumer passes into it.
1 parent 8a845bb commit 49de067

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

addon/services/toaster.ts

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

77
export type ToastData = {
8-
component?: ComponentLike<CustomToastSignature>;
98
title?: string;
109
message?: string;
1110
options: ToastOptions;
1211
};
1312

13+
export type CustomToastData = {
14+
component?: ComponentLike<CustomToastSignature>;
15+
options: object;
16+
}
17+
1418
export type ToastOptions = {
1519
icon?: string | ComponentLike<{ Element: Element }>;
1620
closable?: boolean;
@@ -20,7 +24,7 @@ export type ToastOptions = {
2024

2125
export interface CustomToastSignature {
2226
Args: {
23-
options: ToastOptions;
27+
options: object;
2428
close: () => void;
2529
};
2630
}
@@ -50,7 +54,7 @@ export default class ToasterService extends Service {
5054

5155
show(
5256
component: ComponentLike<CustomToastSignature>,
53-
options: ToastOptions = {},
57+
options: object = {},
5458
) {
5559
const toast = {
5660
component,

tests/integration/components/au-toaster-test.gts

+4-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ module('Integration | Component | au-toaster', function (hooks) {
153153

154154
const CustomToast: TOC<{
155155
Args: {
156-
options: ToastOptionsWithFoo; // Doesn't work
156+
options: {
157+
foo: string
158+
};
159+
// options: ToastOptionsWithFoo; // Doesn't work
157160
// options: ToastOptions; // Works, but fails on the `@options.foo` usage in the template
158161
// options: ToastOptions & { foo: string }; // Doesn't work
159162
close: CustomToastSignature['Args']['close'];

0 commit comments

Comments
 (0)