ricokahler / sanity-codegen

Generate TypeScript types from your Sanity.io schemas
sanity-codegen-dev.vercel.app
MIT License
270 stars 19 forks source link

Re-use SanityDocument definition from @sanity/types #260

Open danmichaelo opened 2 years ago

danmichaelo commented 2 years ago

This tool comes with its own SanityDocument definition, which is not quite compatible with the SanityDocument definition from @sanity/types: https://github.com/sanity-io/sanity/blob/next/packages/%40sanity/types/src/documents/types.ts#L1-L8 : it's missing _type for once, but it also makes it more complicated to use type narrowing when having two different SanityDocument definitions around.

Would it work to instead import the SanityDocument definition from @sanity/types?