Closed JonZhang3 closed 4 days ago
JonZhang3 I think it's about the type inference. When use only Number.isInteger
has not type inference.
But about the implementation, it might make sense to use the Number.isInteger.
https://github.com/sodiray/radash/blob/069b26cdd7d62e6ac16a0ad3baa1c9abcca420bc/src/typed.ts#L36
Radashi (a maintained fork of Radash) already uses Number.isInteger
for its isInt
function.
See here: https://github.com/radashi-org/radashi/blob/main/src/typed/isInt.ts
(Note that the (() => …)()
function is for tree-shaking, and it gets removed when your code is minified.)
JonZhang3 I think it's about the type inference. When use only
Number.isInteger
has not type inference.
That's really something I hadn't thought of, thanks for the tip!
Why not just use
Number.isInteger
here? https://github.com/sodiray/radash/blob/069b26cdd7d62e6ac16a0ad3baa1c9abcca420bc/src/typed.ts#L35