Entry selector.
type EntriesField<
T extends string = string,
F extends Record<string, any> = Record<string, any>,
> = EntriesFieldSingle<T, F> | EntriesFieldSingle<T, F>[];
type RelatedPosts = EntriesField<"blog", { excerpt: string; featured_image: Asset }>;
// Result: {
// id: string;
// title: string;
// slug: string;
// uri: string;
// api_url: string;
// collection: {
// title: string;
// handle: "blog";
// };
// slugs?: Record<string, string> | null;
// excerpt: string;
// featured_image: Asset;
// } | {
// id: string;
// title: string;
// slug: string;
// uri: string;
// api_url: string;
// collection: {
// title: string;
// handle: "blog";
// };
// slugs?: Record<string, string> | null;
// excerpt: string;
// featured_image: Asset;
// }[]
Single entry relationship field.
type EntriesFieldSingle<
T extends string = string,
F extends Record<string, any> = Record<string, any>,
> = (EntryReference<T> & F);
type RelatedPost = EntriesFieldSingle<"blog", { excerpt: string; featured_image: Asset }>;
// Result: {
// id: string;
// title: string;
// slug: string;
// uri: string;
// api_url: string;
// collection: {
// title: string;
// handle: "blog";
// };
// slugs?: Record<string, string> | null;
// excerpt: string;
// featured_image: Asset;
// }