-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Is your feature request related to a problem? Please describe.
It is currently possible to ignore entire individual queries:
// this query won't get generated types because of the instruction below
// @sanity-typegen-ignore
const anotherQuery = groq`*[_type == "another"][0]`My problem is that the only time I want to ignore something, it is parts of a query, not the query itself.
For example, here I query some modules. Then I query those same modules through a reference.
I do not need or want typegen for that second layer (it add a LOT of time to the generation process).
export const BASE_MODULES_FRAGMENT = /* groq */ `
_key,
_type,
_type == 'a' => { ... },
_type == 'b' => { ... },
_type == 'c' => { ... },
`
export const MODULES_FRAGMENT = /* groq */ `
${BASE_MODULES_FRAGMENT},
_type == 'reusable-modules' => {
"modules": reference->modules[] { ${BASE_MODULES_FRAGMENT} }
},
`Describe the solution you'd like
The generator could check within the queries for:
A. Comment
B. Key
C. Object
export const MODULES_FRAGMENT = /* groq */ `
${BASE_MODULES_FRAGMENT},
// @sanity-typegen-ignore
_type == 'reusable-modules' => {
"modules": reference->modules[] { ${BASE_MODULES_FRAGMENT} }
},
"@sanity-typegen-ignore": "",
_type == 'reusable-modules' => {
"modules": reference->modules[] { ${BASE_MODULES_FRAGMENT} }
},
"@sanity-typegen-ignore": {
_type == 'reusable-modules' => {
"modules": reference->modules[] { ${BASE_MODULES_FRAGMENT} }
},
},
`Describe alternatives you've considered
Apart from splitting a query into multiple parts, which is not always possible, I don't think an alternative exists.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels