Diizzayy / nuxt-graphql-client

⚡️ Minimal GraphQL Client + Code Generation for Nuxt3
https://nuxt-graphql-client.web.app
MIT License
339 stars 42 forks source link

Auto-Import all Types of Queries and Fragments #489

Open arcs- opened 1 month ago

arcs- commented 1 month ago

Your use case

On a root page we have a query that gets executed and split into fragments; we then pass down the data into components. To have type-safety we define the props with the fragment type

// child component
import type { ComponentsProductSliderFragment } from '#gql'

const props = defineProps<{
  data: Enforce<ComponentsProductSliderFragment>
}>()

The solution you'd like

Currently we have to define the import with import type { ComponentsProductSliderFragment } from '#gql'. I'd much rather have this one also present in the index.d.ts that gets auto imported with Nuxt. So that we have easy access to the query definitions, fragments and scalars.

Possible alternatives

No response

Additional information

Is there a reason for the current separation?