Files
houseplan-card/src/card-editor-validation.ts
T
2026-08-23 00:34:55 +03:00

14 lines
526 B
TypeScript

export interface CardEditorSpaceOption { value: string; label: string }
/** Missing persisted default_floor, but only after an authoritative load. */
export function invalidDefaultFloor(
config: any,
spaces: readonly CardEditorSpaceOption[] | null,
authoritative: boolean,
): string | null {
if (!authoritative || spaces === null) return null;
const raw = typeof config?.default_floor === 'string' ? config.default_floor : '';
if (!raw || spaces.some((space) => space.value === raw)) return null;
return raw;
}