github logaretm/villus v3.3.0

latest release: v3.4.0
4 months ago

🆕 New Features

Added useQuery data mappers. Similar to subscriptions, you can now pass a second argument to useQuery to map the data and it will be fully typed.

const { data, error } = useQuery(
  {
    query: new TypedDocumentString<{ posts: Post[] }, never>(`
    query Posts {
      posts {
        id
        title
      }
    }
  `),
  },
  ({ data }) => {
    return data?.posts.map(p => p.id) || [];
  },
);

data.value;
//^ number[]

👕 TypeScript

  • Exported mutation execution options type #203 thanks to @jbaubree

Don't miss a new villus release

NewReleases is sending notifications on new releases.