sanity-codegen
sanity-codegen copied to clipboard
Fields with `.required()` validation still end up as optional in the type
A field like this
defineField({
name: "title",
type: "string",
title: "Title",
validation: (Rule) => Rule.required(),
})
still ends up with as optional in the type: title?: string;.
Is this to be expected? I see I can add codegen: { required: true }, to the `defineType object, but the that breaks that parameter's types. So now I'm doing this:
defineField({
name: "title",
type: "string",
title: "Title",
// @ts-ignore
codegen: { required: true },
validation: (Rule) => Rule.required(),
})
Having the same issue