Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th

Types for custom desk structure and generating schema types in Sanity.io

16 replies
Last updated: Aug 9, 2023
Hi, I just created a custom desk structure and I was wondering whether there are built-in types for the
structure builder provided by Sanity?
The following is my example code:

export const deskStructure = (S) =>
        (listItem) => !['archive'].includes(listItem.getId()),
However, since there I am currently not using some
type, there is no intellisense at all.I did look up the official docs on this matter, though I could not seem to find any type for this.

Feedback is much appreciated!
Jul 3, 2023, 4:36 PM
Can you try importing the
type from
? I think that’ll be what you need.
Jul 3, 2023, 4:47 PM
user A
I actually already tried that one before. The structure builder methods don't seem to exist on it, hence using it as the type for
does not work.
Jul 3, 2023, 4:51 PM
And while we are at it, what is the recommended way for generating types for your schemas / groq-query responses? 🙂
Jul 3, 2023, 6:14 PM
Interesting. What if you give
the type
Jul 3, 2023, 9:21 PM
user A
That's it! Thank you very much for your time and help!Would you mind to lead me in the right direction on my other question about generating types for your schemas?
Jul 3, 2023, 10:04 PM
Great! Glad that’s working for you.
I’ve seen offerings like
codegen and sanity-typed , but haven’t used any of them myself and couldn’t offer much in terms of advice, I’m afraid.
Jul 3, 2023, 10:10 PM
user A
Alright, I see! And do you know if there are types for your
files (like intellisense for creating the actual schemas)?Would make it a lot easier to configure things, without constantly having to check the docs
Jul 3, 2023, 10:16 PM
Is that where you use methods like
and so on?
Jul 3, 2023, 10:19 PM
user A
One last question: is there a proper way of excluding a document from the "Create new document" menu at the top-left of your studio?I already have overwritten the document actions in my
, to not show the delete button from some documents, but I don't want multiple instances of them to exist either.
Jul 3, 2023, 10:24 PM
Yes, please check out this guide . It’s about singletons but covers removing a document type from the create new menu.
Jul 3, 2023, 10:26 PM
Thank you! Sometimes I find it hard to actually find these kind of things in your docs.Exceptional support though! Much appreciated!
I wish you a lovely day / evening!
Jul 3, 2023, 10:44 PM
Yes, improvement there is an area of focus right now. If there’s anywhere in particular you feel needs work, please feel free to use the feedback component at the bottom of each page.
Glad we were able to help you here! A great day to you as well!
Jul 3, 2023, 10:48 PM
I see! Will definitely make use of the feedback component!
looks quite promising, as it almost feels like it is / should be part of the actual main
package (by not introducing new complexity and building on top of the existing functionality instead).However, I am wondering how I should get types, which are inferred using
into my frontend project, as my frontend website and sanity studio projects are separated into different packages in my codespace.
Jul 3, 2023, 10:55 PM
I’d suggest starting a new thread for that, since the original question is resolved and no one will see the question here unless they click into the replies. That way, everyone in the community can see it and hopefully you’ll get some advice. 🙌
Jul 3, 2023, 10:58 PM
Jul 3, 2023, 11:11 PM
More @sanity-typed packages have been released by yours truly... 👀
Aug 9, 2023, 11:57 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?