sinclairzx81 / typebox

Json Schema Type Builder with Static Type Resolution for TypeScript
Other
4.65k stars 150 forks source link

Revision 0.32.26 #851

Closed sinclairzx81 closed 3 months ago

sinclairzx81 commented 3 months ago

This PR implements a minor optimization on number checking using only Number.isFinite(x) and omits the typeof x === 'number'. This update reduces the number check to a singular function call. This update also applies a similar change to integer checking where only Number.isInteger(x) is used. Note that TypeSystemPolicy.AllowNaN = true will return the check to typeof x === 'number' for Number types only.

This optimization was suggested by https://github.com/aquapi

Additional updates include small fix to the TemplateLiteral comment in the readme, and a minor update to the overview copy.