We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
The Number.isFinite accepts unknown parameter and returns true only if the parameter is Number. So there should be a type guard saying it's a Number. MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite
Number.isFinite
unknown
true
Number
Playground link with relevant code
function double(x: number | undefined): number { if (Number.isFinite(x)) { return x * 2; // ERROR: Object is possibly 'undefined'. } return 0; }
ERROR: Object is possibly 'undefined'.
No error :)
The text was updated successfully, but these errors were encountered:
Duplicate of #39090. Found using the search terms you provided in your issue. This has been rejected with a fairly good reason already.
Sorry, something went wrong.
No branches or pull requests
Bug Report
The
Number.isFinite
acceptsunknown
parameter and returnstrue
only if the parameter isNumber
.So there should be a type guard saying it's a
Number
.MDN:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite
🔎 Search Terms
Number.isFinite
🕗 Version & Regression Information
Number.isFinite
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
ERROR: Object is possibly 'undefined'.
🙂 Expected behavior
No error :)
The text was updated successfully, but these errors were encountered: