Skip to content

Union of enums: zod enum has no native call signature #285

Closed
@4x4notfound

Description

@4x4notfound
export const EnumATypeSchema = z.nativeEnum(EnumAType)
export const EnumBTypeSchema = z.nativeEnum(EnumBType)

// CURRENT: BAD
export function EnumUnionTypeSchema() {
  return z.union([
    EnumATypeSchema(),
    EnumBTypeSchema(),
  ])
}

// SHOULD BE
export function EnumUnionTypeSchema() {
  return z.union([
    EnumATypeSchema,
    EnumBTypeSchema,
  ])
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions