From 933fb2294ca915ce623b4b7603f28bbd77805523 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 29 Jul 2025 14:11:23 +1000 Subject: [PATCH] fix(ui): zod rejects any board id besides "none" Turns out the string autocomplete TS hack does not translate to zod. Widen the zod schema to any string, but use the hack for the TS type. --- invokeai/frontend/web/src/features/gallery/store/types.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/invokeai/frontend/web/src/features/gallery/store/types.ts b/invokeai/frontend/web/src/features/gallery/store/types.ts index 959cd18301..addeefe870 100644 --- a/invokeai/frontend/web/src/features/gallery/store/types.ts +++ b/invokeai/frontend/web/src/features/gallery/store/types.ts @@ -3,8 +3,9 @@ import z from 'zod'; const zGalleryView = z.enum(['images', 'assets']); export type GalleryView = z.infer; -const zBoardId = z.union([z.literal('none'), z.intersection(z.string(), z.record(z.never(), z.never()))]); -export type BoardId = z.infer; +const zBoardId = z.string(); +// TS hack to get autocomplete for "none" but accept any string +export type BoardId = 'none' | (string & {}); const zComparisonMode = z.enum(['slider', 'side-by-side', 'hover']); export type ComparisonMode = z.infer; const zComparisonFit = z.enum(['contain', 'fill']);