You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make "number" reject Infinity, or make it easy to parse only finite numbers #1598
It should be easy to parse a finite number. In Zod 4, z.number() rejects ±Infinity, but ArkType's "number" seems to accept them.
🤷 Motivation
When parsing a number, it is usually pretty rare for Infinity or -Infinity to be a valid value, and also easy to forget about it. This means that by default, ArkType will often accept invalid data.
💡 Solution
My preferred solution would be to match Zod's behavior: to change "number" so that it rejects Infinity and -Infinity.
Alternatively, you could provide a "number.finite" primitive.
Activity
pullfrog commentedon Mar 15, 2026
feat(type): add number.finite keyword to reject Infinity and NaN (ark…
feat(schema)!: reject Infinity from number by default
docs(type): cite the issues the release fixes and add the entries it …
ssalbdivad commentedon Nov 18, 2026
Fixed in 3.0.0-beta.0 (#1728). Try it with
npm i arktype@next.