rescript-schema
rescript-schema copied to clipboard
`S.float` allows `Infinity` but serialises it to `null`
When serialising Infinity to JSON using S.float, it becomes null. However, this means that when parsing the serialised JSON, sury throws the error Expected number, received null.
I think it'd make sense for S.float to throw an error when given Infinity, just like it does for NaN.
Makes sense. I'll double check the behavior of other libraries.
@DZakh Will the PR for this feature be accepted?
Yes, but I'd say it should use a global flag, just like NaN does. Some thing like safe number check.