Skip to content

v4.2.0

Compare
Choose a tag to compare
@metonym metonym released this 26 Oct 15:50
· 47 commits to master since this release

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
  }}
/>