Open ehwarren opened 1 year ago
I'm going to leave this open since it's been brought up a few times #114 & #138. The long and short of it is that inferred recursive types isn't really possible. Somehow, the typescript loop has to be manually defined. Even the builder plan doesn't really seem to solve the problem.
I'm not too sure this is an issue with the code, however, with no examples I just cant seem to get this to work properly.
Example would be an object called "Button", which contains text and a reference to sanity document types
button.ts
Then we have a reference to this button within the page document as well
page.ts
The Button is a named object because it is used in portable text blocks elsewhere aswell.
The only "solution" i could find right now was to hack the reference within the Button declaration as follows. This eliminates the need to reference the Page document, which is causing the cyclical reference.
Is there any other way around this that I'm just missing?