Skip to content

CollectionSlug

CollectionSlug = GeneratedVexTypes extends object ? S : string

Defined in: packages/core/src/types/generated.ts:60

Union of all collection slugs registered in this project’s VexCMS config.

  • Before vex generate: resolves to string — any string is accepted.
  • After vex generate: resolves to a specific union, e.g. "posts" | "authors".

Used by RelationshipFieldInput.collection so that invalid slugs are caught at compile time without the user passing explicit generic parameters.

// After generation — type is "posts" | "authors" | "tags"
import type { CollectionSlug } from "@vexcms/core"
relationship({ collection: "nonexistent" }) // ✗ Type error after generation
relationship({ collection: "posts" }) // ✓