Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 71x 52x 5x 47x 47x 30x 17x | import { z } from "zod"; export const getAttachments = <Schema extends z.ZodTypeAny>( schema: Schema, ): [string, z.ZodObject<z.ZodRawShape, "strip">][] => { if (schema instanceof z.ZodEffects) { return getAttachments(schema.innerType()); } Eif (schema instanceof z.ZodObject) { if (schema.shape.attachments instanceof z.ZodObject) { return Object.entries(schema.shape?.attachments?.shape ?? {}); } } return []; }; |