Skip to content

Commit

Permalink
[list-group] Refine the typing of the slot element (#1415)
Browse files Browse the repository at this point in the history
  • Loading branch information
fdevillard authored Sep 21, 2024
1 parent aff76e3 commit 5cbe5a7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/lib/list-group/Listgroup.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts">
<script lang="ts" generics="T extends ListGroupItemType | string">
import { createEventDispatcher, setContext, type ComponentProps } from 'svelte';
import { twMerge } from 'tailwind-merge';
import type { ListGroupItemType } from '../types';
Expand All @@ -9,11 +9,15 @@
// propagate props type from underlying Frame
interface $$Props extends ComponentProps<Frame> {
items?: ListGroupItemType[] | string[];
items?: T[];
active?: boolean;
}
export let items: ListGroupItemType[] | string[] = [];
interface $$Slots {
default: { item: T; index: number };
}
export let items: T[] = [];
export let active: boolean = false;
export let defaultClass: string = 'divide-y divide-gray-200 dark:divide-gray-600';
Expand Down

0 comments on commit 5cbe5a7

Please sign in to comment.