Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Breaking change in v4.0.6? #5002

Closed
Closed
@jaswilli

Description

@jaswilli

Hi,

I recently upgraded a project from version3.25.76 to4.0.5 and on versions4.0.6 and later I'm seeing a change in how a schema I'm using is being validated(link to playground).

Prior to4.0.6 when using the following schema:

z.object({  id: z.union(    [      z.number(),      z.string().nullish()    ])    .transform((val) => (val === null || val === undefined ? val : Number(val)))    .pipe(z.number())    .optional()})

An input that didn't contain anid property would validate but now throws an error ("id: invalid_type - Invalid input: expected number, received undefined").

It seems like maybe this was the commit that introduced the change in behavior:ede9629#diff-22c8e6df681ac92b8f6c73108cc92d6f75c13232421cb54f7024195a9b631980

Is this something that can or should be reverted back to previous v3 and early v4 behavior or do I need to work around it?

Thanks!

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp