Skip to content

FieldKeysOfType

FieldKeysOfType<TCollectionSlug, TType> = TCollectionSlug extends keyof CollectionsFieldTypeMap ? TType extends keyof CollectionsFieldTypeMap[TCollectionSlug] ? CollectionsFieldTypeMap[TCollectionSlug][TType] & string : never : never

Defined in: packages/core/src/api/types.ts:308

Returns the union of field keys on TCollectionSlug that have field type TType.

Reads the CollectionsFieldTypeMap property on the augmented GeneratedVexTypes registry — populated by vex generate from the user’s collection configs. Returns never when the slug has no fields of that type, or when the registry hasn’t been augmented yet (fresh project).

TCollectionSlug extends CollectionSlug

The collection slug.

TType extends AdminFieldType

The field type literal (e.g., "text", "relationship").

type AuthorRelationships = FieldKeysOfType<"posts", "relationship">;
// → "author" | "category"