-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi,
We upgraded to the latest Sanity package due to a Snyk security report.
Now typegen is reporting 300+ type errors (typegen has been made stricter)
It is due to the fact that typegen does not support:
Template literal fragments - reusable code like ${heroBlockFields}
Conditional projections - logic like _type == "heroBlock" => {...}
Our Current Workaround (Unsustainable):
- Revert to old Sanity version
- Run typegen
- Upgrade back to latest version
The best way to solve it "properly" that we found:
Use @sanity-typegen-ignore on all queries and manually maintain query types separately from schema types.
Cost: Manual type maintenance for 26 queries, ongoing sync burden.
Questions:
- Is this the recommended approach for projects using modular queries?
- Are there plans to support template literal fragments in TypeGen?
- TypeGen is marked "experimental" but also "recommended" - should production projects rely on it?
Kind regards
Jerome
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels