-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Number.isInteger and others should accept any and act as type guards #21199
Comments
Seems like one of many duplicates of #4002, and maybe a duplicate of #19557, and another opportunity to think about how to prevent such duplicates. Maybe the text under You don't want anything to act as |
I see, it makes sense. I did search for isInteger before submitting but it didn't occur to me to search for isNaN etc. |
Sure, it happens. The relevant advice in the contributing guidelines says "Check for synonyms. For example, if your bug involves an interface, it likely also occurs with type aliases or classes." (I guess the word "synonyms" should probably be replaced with "related terms", since the example isn't showing literal synonyms anyway.) The question is: is the stuff in that document the best we can do to guide potential issue-filers to find potential duplicates without scaring them away entirely? A prominent warning like "You're probably not the first person to encounter this issue; you'd better spend at least an hour searching through the existing issues for every possible related term before filing; if you file a duplicate, we will send monsters to devour you." would probably cut down on the false positives, but false negatives are bad too. Oh well, who knows? |
Heh, thanks for the advice. I'll make sure to search for at least an hour before requesting something like |
I opened #24436 without finding this (apparently I also searched for the wrong keywords). However, this (and #24436) are not duplicates of #4002. Despite the similarity in naming, |
TypeScript Version: 2.7.0-dev.20180116
Code
Expected behavior:
It should compile without errors.
Actual behavior:
The compiler complains as follow:
Proposed solution:
Rewrite es6 type definition of NumberConstructor.isInteger (et al.) like this:
The text was updated successfully, but these errors were encountered: