nuxt-graphql-client icon indicating copy to clipboard operation
nuxt-graphql-client copied to clipboard

Auto-Import all Types of Queries and Fragments

Open arcs- opened this issue 8 months ago • 0 comments

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?

arcs- avatar May 30 '24 11:05 arcs-