Skip to content

z.never() within union not behaving as it used to since 4.4.0 #5993

@didinele

Description

@didinele

A user filed a bug for discord.js where a previously functional input no longer worked.

Boiling down the issue to its most minimal form (past all the nested union and intersection types), the difference boiled down to this:

Image Image

The issue still occurs as of 4.4.3:

Image

For now, I decided to fix it by replacing the predicate with

choices: z.array(z.any()).length(0).optional()

See discordjs/discord.js#11532

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions