toNumberPreprocessor converts empty string to 0
Gambitier opened this issue · 1 comments
Gambitier commented
javascript converts empty string to 0. So if the this preprocessor is applied for number and if input is empty string then after transformation we receive value 0 which is number and hence zod doesn't throw any error
console.log(+''); // 0
zod-extras/src/utils/toNumberPreprocessor.ts
Lines 6 to 8 in cbe209b
lokankr commented
Thank you for the report! This has been fixed and v2.0.0
has been released.