You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever I need a type from groqd, I often need to either copy it from the declarations file myself or make an arbitrary query to extract it's type:
// src/utils/groqd.types.ts// copied from index.d.tsexporttypeWithAssetOption=|"base"|"dimensions"|"location"|"lqip"|"palette"|"isOpaque"|"hasAlpha"|"blurHash";constunknownArrayQuery=q("").filter();exporttypeUnknownArrayQuery=typeofunknownArrayQuery;constentityQuery=q("").filter().slice(0);exporttypeEntityQuery=typeofentityQuery;
It would be nice if the library exported its types, not only to make it simpler to build wrappers around it, but also to make sure that we don't end up with outdated types on our end after updating groqd.
Currently, these are the only things that can be imported:
import{q,z,sanityImage,makeSafeQueryRunner,nullToUndefined,pipe,// Not sure what this is, it's not documented anywheretypeBaseQuery,typeGroqdParseError,typeInferType,typeSelection,typeTypeFromSelection,}from"groqd";
The text was updated successfully, but these errors were encountered:
This is, if anything, even more relevant with the release of 1.x. The complexity of the types being used internally makes it really difficult to use the library in a typesafe way in a functional way. I keep running into issues where, even reaching in to the module to pull out internal types, the complexity of the type checks being performed internally makes it incredibly difficult to write functions that wrap reused Groqd logic. For example, try defining a function which takes in a query and a projection over that query, performs some common filters, and then applies the provided projection. The complexity of the ProjectionMap type makes this incredibly difficult even breaking module isolation.
Is there an existing issue for this?
Code of Conduct
Feature Request
Whenever I need a type from groqd, I often need to either copy it from the declarations file myself or make an arbitrary query to extract it's type:
It would be nice if the library exported its types, not only to make it simpler to build wrappers around it, but also to make sure that we don't end up with outdated types on our end after updating groqd.
Currently, these are the only things that can be imported:
The text was updated successfully, but these errors were encountered: