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
🐛 The bug
I'm working on a schema that contain section and page document types. A section contains an array of references to page and a page contains a reference to a section. When adding the custom types like described in the documentation the typechecking breaks (everything is infered as any). When I replace the custom type with a plain object like { _type: 'page' } the type inference (partly) works again, so this probably has to do with the fact that section and page reference each other causing it to break.
I wanted to follow up immediately with some possible solutions.
Generate types on runtime. You could generate a CustomType type which consists of all the documents / objects that were defined. An example of this would be @nexus/schema.
Leave it to the user to create a CustomType type. A quick example I could think of would look like this:
🐛 The bug
I'm working on a schema that contain
section
andpage
document types. Asection
contains an array of references topage
and a page contains a reference to asection
. When adding the custom types like described in the documentation the typechecking breaks (everything is infered as any). When I replace the custom type with a plain object like{ _type: 'page' }
the type inference (partly) works again, so this probably has to do with the fact thatsection
andpage
reference each other causing it to break.🛠️ To reproduce
Steps to reproduce the behavior:
For example: https://gist.github.com/waspeer/f831dbb06ea59f8f8ca04575e1962cf3
Here the type inference of the variables
section
,page
andRule
fail.ℹ️ Additional context
Thanks for you work on this library!
The text was updated successfully, but these errors were encountered: