Issues with types in sanity/structure (desk) after recent changes

11 replies
Last updated: Jan 31, 2024
With the recent change in sanity/structure (desk), there appear to be some issues with the types 👀 Any ideas when it be resolved?
AI Update

I understand you're experiencing TypeScript type issues with sanity/structure imports after recent changes. While I can confirm that the Desk Tool was officially renamed to Structure Tool (and imports changed from sanity/desk to sanity/structure), I don't have verified information about specific ongoing type issues with the current implementation.

What Changed

The Structure Tool documentation confirms the official migration:

Old (Desk Tool):

import { deskTool } from 'sanity/desk'

New (Structure Tool):

import { structureTool } from 'sanity/structure'

If You're Experiencing Type Issues

Without being able to verify the specific issue you're encountering, here are some general troubleshooting steps:

  1. Ensure you're using the correct import path: Make sure you've updated all imports to use 'sanity/structure' instead of 'sanity/desk'

  2. Check your Sanity version: Run npm list sanity to confirm your installed version. Type definitions should be included with the package.

  3. Clear TypeScript cache: Sometimes TypeScript's language server needs a restart. In VS Code, use "TypeScript: Restart TS Server" from the command palette.

  4. Verify your tsconfig.json: Ensure your TypeScript configuration properly resolves node_modules types.

  5. Check for conflicting files: If you have a custom structure configuration file, ensure it's not creating naming conflicts with the module import.

Getting Help

Since I cannot verify the specific issue you're facing, I'd recommend:

  • Check the Sanity GitHub repository for open issues related to sanity/structure types
  • Share your specific error message in the Sanity Community Slack - the community and Sanity team can provide more targeted help with the actual error
  • Include details like your Sanity version, TypeScript version, and the exact error message you're seeing

If there's a known issue with a timeline for resolution, the Sanity team typically communicates this through GitHub issues or community channels. I apologize I couldn't provide more specific information about the particular issue you're experiencing.

Show original thread
11 replies
I had the same warning, I just changed the imports to sanity/structure as the message says. Everything worked just fine.
Same here, changed everything to structure and its working as normal
Same but I have some warnings (see second screenshots)
Argument of type 'StructureBuilder' is not assignable to parameter of type 'StructureBuilder_2'
can you share the screenshot of /settings.ts
Indeed I didn’t changed the desk -> structure on the settings structure 😅
It’s working fine now 👍
Sometimes you just need to read the TS warnings haha
"Just read the f****** message" hahaha
Thanks for the quick feedback 😉
we’re all sinners here — glad you sorted it out 🙇‍♂️

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?