v4.2.0
Features
- use TypeScript generics so that the item type can be inferred from
data
value
<script lang="ts">
import Typeahead from "svelte-typeahead";
const data = [
{ id: 1, state: "North Carolina" },
{ id: 2, state: "North Dakota" },
{ id: 3, state: "South Carolina" },
{ id: 4, state: "South Dakota" },
];
</script>
<Typeahead
{data}
extract={(item) => {
return item.state; // type "string" is inferred
}}
/>