Skip to content
HomePagesHomePages template kit

SlotValue

Maps one slot definition (as authored under a section schema's `slots`) to the runtime value shape a renderer receives at `props.slots[<key>]`, as normalized by the binding layer.

Maps one slot definition (as authored under a section schema’s slots) to the runtime value shape a renderer receives at props.slots[<key>], as normalized by the binding layer. String-valued kinds (text, select, url) are plain string — the canonical blank is "", never null; a number, image, poi or document slot’s blank is null. A list slot is always an array, never null — an empty list is the absent state. A record list bound whole-row to a bakeable fact array types its rows from that collection’s projected row type (see BakedRowValue), not from a synthesis of its declared fields.

Import from @homepages/template-kit.

export type SlotValue<S> = S extends {
type: "text";
} ? string : S extends {
type: "number";
} ? number | null : S extends {
type: "select";
} ? string : S extends {
type: "image";
} ? ImageValue | null : S extends {
type: "video";
} ? VideoValue | null : S extends {
type: "tour";
} ? TourValue | null : S extends {
type: "list";
source: {
kind: "direct";
field: infer F extends CollectionField;
};
fields: infer I;
} ? BakedRowValue<F, I>[] : S extends {
type: "list";
fields: infer I;
} ? RowValue<I>[] : S extends {
type: "list";
element: infer E;
} ? NonNullable<SlotValue<E>>[] : S extends {
type: "list";
} ? unknown[] : S extends {
type: "poi";
} ? PoiRow | null : S extends {
type: "url";
} ? string : S extends {
type: "document";
} ? DocumentValue | null : never;