github logaretm/villus v3.3.0

latest releases: v3.5.1, v3.5.0, v3.4.0...
11 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.