Is it possible in Svelte to define a strongly typed array that matches the properties exported by a specific component?
For instance, if I have the following code snippet, const things = []
, is there a way for Svelte to recognize that each item within the array should have a name and an age property based on the component's exports?
<script lang="ts">
// Thing.svelte
export let name: string;
export let age: number;
</script>
<script lang="ts">
// +Page.svelte
import Thing from '$lib/Thing.svelte';
const things = [{
naem: "Bob",
age: 36
}];
</script>
{#each things as thing}
<Thing {...thing} />
{/each}
I would appreciate any guidance on how I can achieve this without creating my own custom ThingOptions type. Thank you!