The Svelte tutorial demonstrates how to declare a table row snippet:
<tbody>
{#snippet monkey()}...{/snippet}
{@render monkey()}
</tbody>
So far so good. Makes sense to put a snippet close to where it is being used - a table row snippet indeed belongs in tbody
.
I also want to reuse a table row snippet. Except I use the Flowbite Svelte component library. So the code looks like this:
<Table>
...
<TableBody>
{#snippet row(row: UserProductListEntry)}
{row.product.title}
{/snippet}
This works at runtime, but it has issues due to the snippet implicitly becoming TableBody's prop:
- I'm getting this type error:
Is this an IDEA Svelte plugin's error? It doesn't have any references e.g. to ESLint. Should it be a warning and/or suppressible? I haven't found anything like this at the JetBrains's issue tracker.
- (Less important) In this case I don't intend to pass the snippet to TableBody as a prop. What if it just so happens to expect a snippet by the same name?
So the question is, is there a way to opt out this snippet from becoming an implicit prop? Or at least deal with issue 1 somehow, without moving the snippet out of the TableBody and Table?