Skip to content

Typescript conflicts with DocumentOptions #10

Open
@chris-erickson

Description

@chris-erickson

Specifying

export default defineType({
  name: "advisoryNote",
  title: "Advisory Note",
  type: "document",
  icon: WarningOutlineIcon,
  options: {
    singleton: true,
  },

now seems to conflict with some core Sanity types:

sanity/schemas/singleton/advisoryNote.ts:11:5 - error TS2353: Object literal may only specify known properties, and 'singleton' does not exist in type 'BaseSchemaTypeOptions'.

11     singleton: true,
       ~~~~~~~~~

and

The expected type comes from property 'options' which is declared here on type '{ type: "document"; name: "advisoryNote"; } & Omit<DocumentDefinition, "preview"> & { preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined; }'

sanity/schemas/singleton/settings.ts:11:5 - error TS2353: Object literal may only specify known properties, and 'singleton' does not exist in type 'BaseSchemaTypeOptions'.

11     singleton: true,
       ~~~~~~~~~

Should we stop using this package and perhaps do something like this ourselves (a bit old, but seems to be for Sanity v3, however) https://www.sanity.io/guides/singleton-document

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions