Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix schema types
Oleg Isonen662bfa580a45
diff --git a/apps/designer/app/designer/shared/design-tokens-manager/schema.ts b/apps/designer/app/designer/shared/design-tokens-manager/schema.tsindex d720c6d6a6..1f00492870 100644--- a/apps/designer/app/designer/shared/design-tokens-manager/schema.ts+++ b/apps/designer/app/designer/shared/design-tokens-manager/schema.ts@@ -1,34 +1,19 @@import { z } from "zod";import { groups } from "./groups";-type UnionToIntersection<U> = (- U extends never ? never : (arg: U) => never-) extends (arg: infer I) => void- ? I- : never;--type UnionToTuple<T> = UnionToIntersection<- T extends never ? never : (t: T) => T-> extends (_: never) => infer W- ? [...UnionToTuple<Exclude<T, W>>, W]- : [];-type Type = typeof groups[number]["type"];type Group = typeof groups[number]["group"];-// zod is super restrictive on enum type https://github.com/colinhacks/zod/issues/1118-// so we convert union to tuple here its seriously safer than any as it will break on things like-// ['a', 'b'] as UnionToTuple<Type> etc-const types = groups.map((group) => group.type) as UnionToTuple<Type>;-const groupNames = groups.map((group) => group.group) as UnionToTuple<Group>;+const types = groups.map((group) => group.type) as unknown as readonly [Type];+const groupNames = groups.map((group) => group.group) as unknown as readonly [+ Group+];export const DesignToken = z.object({name: z.string(),- // @todo if https://github.com/colinhacks/zod/issues/1118type: z.enum(types),value: z.string(),description: z.optional(z.string()),- // @todo if https://github.com/colinhacks/zod/issues/1118group: z.enum(groupNames),});