Remove redundant isNaN check in number parser
Author: AaroniusCreated Sep 15, 2026Updated Sep 15, 2026
The parse logic for number contains this conditional:
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {The Number.isNaN check can be removed here because Number.isFinite will already return false if input is NaN. This also aligns the conditional with the one in compile.ts.
I have this change in a branch on my fork. I'm happy to open a PR (I don't have access to do so) if you'd like.
Source: colinhacks/zod