Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IsInteger and IsFloat; Fix Integer and Float handing with edge case #857

Merged
merged 14 commits into from Apr 22, 2024

Conversation

Emiyaaaaa
Copy link
Collaborator

fixed: #637

Breaking but I think it's the corrent changes:

type Change1 = Integer<1 | 1.5>
// latest version => never // auther commented: This may be undesired behavior
// this PR        => 1

type Change2 = Integer<1e+100>
// latest version => never
// this PR        => 1e+100 // Number.IsInteger(1e+100) is true

type Change3 = Float<PositiveInfinity>
// latest version => PositiveInfinity
// this PR        => never // Infinity isn't a float.

And clarifies how to deal with some special number type like '1.0', '0x10' and negative number

source/numeric.d.ts Outdated Show resolved Hide resolved
source/numeric.d.ts Outdated Show resolved Hide resolved
source/numeric.d.ts Show resolved Hide resolved
@Emiyaaaaa
Copy link
Collaborator Author

Emiyaaaaa commented Apr 9, 2024

Should we expose IsFloat and IsInteger? I think these are useful types. @sindresorhus

I can move these into internal.ts first, then add document and expose later or in a new PR.

@sindresorhus
Copy link
Owner

Yes. I think they are useful too. Up to you whether it's done now or in a later PR.

@Emiyaaaaa Emiyaaaaa closed this Apr 17, 2024
@Emiyaaaaa Emiyaaaaa reopened this Apr 17, 2024
@Emiyaaaaa Emiyaaaaa marked this pull request as draft April 17, 2024 07:04
@Emiyaaaaa Emiyaaaaa marked this pull request as ready for review April 22, 2024 04:33
@Emiyaaaaa Emiyaaaaa changed the title Integer and Float: fix handing with edge case Add IsInteger and IsFloat; Fix Integer and Float handing with edge case Apr 22, 2024
@sindresorhus sindresorhus merged commit f5b09de into sindresorhus:main Apr 22, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integer<1e+100> should be 1e+100, but it is never
2 participants