Skip to content

Commit 811ba2c

Browse files
author
kyvg
committed
Fix body slot type
1 parent 29c1b97 commit 811ba2c

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

src/components/Notifications.tsx

+5-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HTMLAttributes, PropType, SetupContext, SlotsType, computed, defineComponent, onMounted, ref } from 'vue';
1+
import { HTMLAttributes, PropType, SlotsType, computed, defineComponent, onMounted, ref } from 'vue';
22
import { params } from '@/params';
33
import { Id, listToDirection, Timer, NotificationItemWithTimer, emitter, parse } from '@/utils';
44
import defaults from '@/defaults';
@@ -18,16 +18,6 @@ type NotificationItemExtended = NotificationItemWithTimer & {
1818
state: NotificationItemState[keyof NotificationItemState];
1919
}
2020

21-
type Emit = {
22-
click: [item: NotificationItem],
23-
destroy: [item: NotificationItem],
24-
start: [item: NotificationItem],
25-
}
26-
27-
type Slots = SlotsType<{
28-
body?: (props: { class: HTMLAttributes['class'], item: NotificationItem, close: () => void }) => any;
29-
}>
30-
3121
export default defineComponent({
3222
// eslint-disable-next-line vue/multi-word-component-names
3323
name: 'notifications',
@@ -126,7 +116,10 @@ export default defineComponent({
126116
start: (item: NotificationItem) => true,
127117
/* eslint-enable @typescript-eslint/no-unused-vars */
128118
},
129-
setup: (props, { emit, slots, expose }: SetupContext<Emit, Slots>) => {
119+
slots: Object as SlotsType<{
120+
body?: (props: { class: HTMLAttributes['class'], item: NotificationItem, close: () => void }) => any;
121+
}>,
122+
setup: (props, { emit, slots, expose }) => {
130123
const list = ref<NotificationItemExtended[]>([]);
131124
const timerControl = ref<Timer | null>(null);
132125
const velocity = params.get('velocity');

src/components/group/VelocityGroup.tsx

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import { SetupContext, TransitionGroup, defineComponent } from 'vue';
2-
3-
type Emit = {
4-
enter: [element: Element, done: () => void],
5-
leave: [element: Element, done: () => void],
6-
afterLeave: [],
7-
}
1+
import { TransitionGroup, defineComponent } from 'vue';
82

93
export default defineComponent(
104
{
@@ -23,7 +17,7 @@ export default defineComponent(
2317
afterLeave: () => true,
2418
/* eslint-enable @typescript-eslint/no-unused-vars */
2519
},
26-
setup: (props, { slots, emit }: SetupContext<Emit>) => {
20+
setup: (props, { slots, emit }) => {
2721

2822

2923
const handleEnter = (element: Element, done: () => void) => {

0 commit comments

Comments
 (0)