I am currently in the process of creating a blog using the Sanity CMS platform, and I recently generated some schema types using the Sanity CLI, opting for the blog configuration. However, TypeScript is flagging some warnings related to these types.
Here is a snippet from my author.ts
file:
import { defineField, defineType } from 'sanity';
export default defineType({
name: 'author',
title: 'Author',
type: 'document',
fields: [
// Fields definition here
],
preview: {
select: {
title: 'name',
media: 'image',
},
},
});
I am encountering 2 errors, one pertaining to the image
field under the fields
section:
Error Message Here
and the other one is regarding the bio
field under the of
section:
Error Message Here
How can I modify these schema types to function correctly within Sanity CMS without triggering these TypeScript errors?
The versions of the packages I am using are: next-sanity
v9.0.16, sanity
3.44.0, @sanity/types
3.44.0, and typescript
5.0.4.