Here's how you can know what type item
has in the parent component so you get nice autocompletion :)
<script lang="ts">
type Item = $$Generic;
export let items: Item[] = [];
</script>
<ul>
{#each items as item, index}
<li>
<slot {item} {index} />
</li>
{/each}
</ul>
use it like this
<List items={['you', 'are', 'so', 'cool']} let:item>
<p>{item}</p>
</List>
The type of item
in the paragraph tag will be string
instead of any
.