mirror of
https://github.com/documenso/documenso
synced 2026-05-24 09:28:27 +00:00
fix: handle empty object as fieldMeta
This commit is contained in:
parent
058d9dd0ba
commit
0ef85b47b1
1 changed files with 10 additions and 1 deletions
|
|
@ -113,7 +113,16 @@ export const ZFieldMetaNotOptionalSchema = z.discriminatedUnion('type', [
|
|||
|
||||
export type TFieldMetaNotOptionalSchema = z.infer<typeof ZFieldMetaNotOptionalSchema>;
|
||||
|
||||
export const ZFieldMetaSchema = ZFieldMetaNotOptionalSchema.optional();
|
||||
export const ZFieldMetaSchema = z
|
||||
.union([
|
||||
// Handles an empty object being provided as fieldMeta.
|
||||
z
|
||||
.object({})
|
||||
.strict()
|
||||
.transform(() => undefined),
|
||||
ZFieldMetaNotOptionalSchema,
|
||||
])
|
||||
.optional();
|
||||
|
||||
export type TFieldMetaSchema = z.infer<typeof ZFieldMetaSchema>;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue