mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-13 02:05:08 -05:00
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.
This commit is contained in:
committed by
Kent Keirsey
parent
5a181ee0fd
commit
933fb2294c
@@ -3,8 +3,9 @@ import z from 'zod';
|
||||
|
||||
const zGalleryView = z.enum(['images', 'assets']);
|
||||
export type GalleryView = z.infer<typeof zGalleryView>;
|
||||
const zBoardId = z.union([z.literal('none'), z.intersection(z.string(), z.record(z.never(), z.never()))]);
|
||||
export type BoardId = z.infer<typeof zBoardId>;
|
||||
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<typeof zComparisonMode>;
|
||||
const zComparisonFit = z.enum(['contain', 'fill']);
|
||||
|
||||
Reference in New Issue
Block a user