Skip to content

Commit 933fb22

Browse files
psychedelicioushipsterusername
authored andcommitted
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.
1 parent 5a181ee commit 933fb22

File tree

1 file changed

+3
-2
lines changed
  • invokeai/frontend/web/src/features/gallery/store

1 file changed

+3
-2
lines changed

invokeai/frontend/web/src/features/gallery/store/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import z from 'zod';
33

44
const zGalleryView = z.enum(['images', 'assets']);
55
export type GalleryView = z.infer<typeof zGalleryView>;
6-
const zBoardId = z.union([z.literal('none'), z.intersection(z.string(), z.record(z.never(), z.never()))]);
7-
export type BoardId = z.infer<typeof zBoardId>;
6+
const zBoardId = z.string();
7+
// TS hack to get autocomplete for "none" but accept any string
8+
export type BoardId = 'none' | (string & {});
89
const zComparisonMode = z.enum(['slider', 'side-by-side', 'hover']);
910
export type ComparisonMode = z.infer<typeof zComparisonMode>;
1011
const zComparisonFit = z.enum(['contain', 'fill']);

0 commit comments

Comments
 (0)