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

Is.number missing union with null #1

Closed
Honga1 opened this issue Feb 7, 2022 · 2 comments
Closed

Is.number missing union with null #1

Honga1 opened this issue Feb 7, 2022 · 2 comments

Comments

@Honga1
Copy link

Honga1 commented Feb 7, 2022

Hey :) I saw your lib on reddit. I was just reading the source and saw this:

public static number(value: unknown, allowNull = false): value is number {

Shouldn't you return number | null if it is allowed to be null?

@dec-land
Copy link
Owner

dec-land commented Feb 7, 2022

You're right! I'll actually remove the allowNull checks, they were specific to my project in which I was filtering out properties from an object unless they were the correct type. But if they were null I wanted them to remain.

I should really enable strict mode too in the tsconfig which would have reported a warning here, it was disabled in the legacy projects i've been working on which I created as-is for. Good spot 👍

@dec-land dec-land closed this as completed Feb 7, 2022
@dec-land
Copy link
Owner

dec-land commented Feb 7, 2022

Issue closed, allowNull has been removed as stated above. Ty :)

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

No branches or pull requests

2 participants