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

disallow NaN for number types #11

Open
mmkal opened this issue Oct 28, 2017 · 3 comments
Open

disallow NaN for number types #11

mmkal opened this issue Oct 28, 2017 · 3 comments

Comments

@mmkal
Copy link

mmkal commented Oct 28, 2017

How about an option to throw when NaN is assigned to a number type?
Right now this library allows things like const x: number = parseFloat("hello");

...which makes sense as default behaviour because typeof NaN === "number" in JavaScript, but it'd be useful to be able to use this library to do things like safely parse values in a querystring, coming from a redis cache, etc. etc.

So could it be another cli option or something?

@fabiandev
Copy link
Owner

This is definitely a good idea. I'm currently thinking about utilizing typescript-json-schema, which would mean quite a number of changes to the project, but I will keep this in mind.

@fabiandev fabiandev added this to the 1.0 milestone Jan 6, 2018
@mmkal
Copy link
Author

mmkal commented Jan 26, 2018

Hi - is 1.0 still being worked on? Is there a branch?

@fabiandev
Copy link
Owner

I'm still exploring different ways of checking types at runtime to improve performance (one being #13 after looking into #10), however, my time was limited. There is currently no remote branch.

@mmkal mmkal closed this as completed Mar 7, 2018
@mmkal mmkal reopened this Mar 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants