Skip to content

Typegen cannot generate types from plugins #1407

@praburangki

Description

@praburangki

Version

module: 2.1.0
nuxt: 4.2.2

Nuxt configuration

sanity: {
    apiVersion: '2026-01-01',
    dataset: process.env.SANITY_DATASET,
    projectId: process.env.SANITY_PROJECT_ID,
    typegen: {
      enabled: true,
      schemaTypesPath,
    },
  },

Reproduction

  1. Checkout this repo
  2. Add this plugin (sanity-plugin-internationalized-array) to the playground/cms
  3. Create one field that has the type of: internationalizedArrayString
  4. Run nuxt prepare

What is expected?

Type is generated.

What is actually happening?

WARN Could not generate Sanity types: Unknown type: internationalizedArrayString

Additional information

I tried running using sanity's CLI: pnpm sanity schema extract and it knows those types and there were no issues. Tried to dig in, in this module is using:

import { builtinTypes, extractSchema } from '@sanity/schema/_internal'

Then I tried to find how does sanity do it and apparently it's using the same method extractSchema from the same _internal. Then I was tracing and it was not that simple, I'm suspicious it's calling this function:

https://github.com/sanity-io/sanity/blob/8618f8476bbff6db439e1676fecd5c742315f3ad/packages/sanity/src/core/config/resolveSchemaTypes.ts

Not sure what is the best approach to implement this.

Checklist

  • I have tested with the latest Nuxt version and the issue still occurs
  • I have tested with the latest module version and the issue still occurs
  • I have searched the issue tracker and this issue hasn't been reported yet

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions