Skip to content

feat: added G.isFinite, G.isInfinite#109

Open
JUSTIVE wants to merge 3 commits intomobily:masterfrom
JUSTIVE:feat/Guard/isFinite
Open

feat: added G.isFinite, G.isInfinite#109
JUSTIVE wants to merge 3 commits intomobily:masterfrom
JUSTIVE:feat/Guard/isFinite

Conversation

@JUSTIVE
Copy link

@JUSTIVE JUSTIVE commented Mar 10, 2024

resolves #108

@JUSTIVE
Copy link
Author

JUSTIVE commented Mar 10, 2024

Attempted with rescript with gentype, but Js.Float.isFinite turned into $$isFinite. I'm not sure why, so currently it's implemented with js and type definitions. if anyone knows reason why, please let me know.

@JUSTIVE
Copy link
Author

JUSTIVE commented Mar 11, 2024

https://forum.rescript-lang.org/t/prefix-from-build-output/5115/2?u=justive

$$ appeared because of the ambiguity of the isFinite, which is globally available on the js side.

@motherthestate
Copy link

motherthestate commented Mar 11, 2024

@JUSTIVE Hey, thanks for the PR :). Looking at the typing maybe replicating the isNumber type would be more practical, since Number.isFinite is typed isFinite(number: unknown) by default, we would just extend it with a type predicate.

export declare function isFinite<A>(
  value: A | number,
): value is Guard<A, number>

Edit: @JUSTIVE Also I don't know how likely these PR are to be merged, seeing how many are racking up and staying open. The last merge seems to date back to 2022.

@JUSTIVE
Copy link
Author

JUSTIVE commented Mar 11, 2024

I'm also not sure when @mobily will be back, but I believe he will, as he said on #93.
As a daily ts-belt user, I really love this library, and hope to keep maintained.

just updated the type as you said, thanks for the reply.

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.

Proposal: G.isFinite

2 participants

Comments