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
That code has a build error at the .project call stating:
Argument of type '[]' is not assignable to parameter of type '["⛔️ Error: this projection has type mismatches: ⛔️"] | ["Error in \"title\": ⛔️ Parser expects a different input type ⛔️"]'.
Type '[]' is not assignable to type '["Error in \"title\": ⛔️ Parser expects a different input type ⛔️"]'.
Source has 0 element(s) but target requires 1.ts(2345)
If I replace the call with the shorthand form, then it compiles:
I think this is a result from the complexity of the ProjectionMap type being larger than the TS compiler can handle in practice. I've also been running into issues attempting to make a service function that takes in a GroqBuilder and projection, and would then call builder.filter(/* some common filters across my CMS */).project(projection) - it doesn't seem possible to define a parameter type for projection which will actually work as an argument to .project. Even directly copy-pasting it from the internal function declaration, I get type mismatch errors.
The text was updated successfully, but these errors were encountered:
I believe I have the same issue, but let me know if I should file a different issue! I attempted to set up a simple query following the docs, which should just validate that a given slug exists:
Is there an existing issue for this?
Code of Conduct
Code Sandbox link
No response
Bug report
Running code as shown in the docs against my own schema is throwing a type error:
For reference, the Banner type inside of SanityTypes looks like:
That code has a build error at the
.project
call stating:If I replace the call with the shorthand form, then it compiles:
I think this is a result from the complexity of the ProjectionMap type being larger than the TS compiler can handle in practice. I've also been running into issues attempting to make a service function that takes in a
GroqBuilder
and projection, and would then callbuilder.filter(/* some common filters across my CMS */).project(projection)
- it doesn't seem possible to define a parameter type forprojection
which will actually work as an argument to.project
. Even directly copy-pasting it from the internal function declaration, I get type mismatch errors.The text was updated successfully, but these errors were encountered: