mirror of
https://github.com/outline/outline.git
synced 2026-05-08 02:50:30 -05:00
feat: Unified icon picker (#7038)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export function zodEnumFromObjectKeys<
|
||||
TI extends Record<string, any>,
|
||||
R extends string = TI extends Record<infer R, any> ? R : never
|
||||
>(input: TI): z.ZodEnum<[R, ...R[]]> {
|
||||
const [firstKey, ...otherKeys] = Object.keys(input) as [R, ...R[]];
|
||||
return z.enum([firstKey, ...otherKeys]);
|
||||
}
|
||||
Reference in New Issue
Block a user