Skip to content

asRobotsCollection requires schema despite documentation suggesting it's optional #479

@nsina

Description

@nsina

🐛 The bug

Description

The documentation at https://nuxtseo.com/docs/robots/guides/content suggests that asRobotsCollection() should work without requiring a schema, but TypeScript throws an error when schema is omitted.

Actual Behavior

TypeScript error: Argument of type 'Collection<unknown>' is not assignable to parameter of type 
  'Collection<ZodRawShape>'

🛠️ To reproduce

🌈 Expected behavior

Based on the docs, this should work:

asRobotsCollection({
  type: "page",
  source: "1.docs/**/*",
})

ℹ️ Additional context

Environment

  • @nuxtjs/robots: 5.5.5
  • @nuxt/content: 3.6.3
  • Nuxt: 4.1.0

Workaround

Adding empty schema: schema: z.object({})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions