We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
TypeScript Version: 3.5.2
Search Terms: undefined, function arguments, variable, if condition, static code analysis
Code
const foo = (bar: number) => {}; const someOtherFunction = (bar?: number) => { const shouldCallFoo = !!bar; if (shouldCallFoo) { foo(bar); } }
Expected behavior:
The code compiles without any problems
Actual behavior:
Error:
Argument of type 'number | undefined' is not assignable to parameter of type 'number'. Type 'undefined' is not assignable to type 'number'.
Playground Link: http://www.typescriptlang.org/play/#code/MYewdgzgLgBAZiEMC8MAUAjAhgJwFwxgCuAthgKY4CUKAfDAN4C+A3AFBuiSwQgnkB5KAAtKAMSJhgUAJbgU6bDgD8BYmUo1k9Bmxj6YXaDAjCQRADYATAMJYLFsYgVL2egzLjpT563YdOIDS6BqHwiJi4VOyhTGxMQA
Related Issues:
The text was updated successfully, but these errors were encountered:
This is tracked at #12184.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
TypeScript Version: 3.5.2
Search Terms: undefined, function arguments, variable, if condition, static code analysis
Code
Expected behavior:
The code compiles without any problems
Actual behavior:
Error:
Playground Link: http://www.typescriptlang.org/play/#code/MYewdgzgLgBAZiEMC8MAUAjAhgJwFwxgCuAthgKY4CUKAfDAN4C+A3AFBuiSwQgnkB5KAAtKAMSJhgUAJbgU6bDgD8BYmUo1k9Bmxj6YXaDAjCQRADYATAMJYLFsYgVL2egzLjpT563YdOIDS6BqHwiJi4VOyhTGxMQA
Related Issues:
The text was updated successfully, but these errors were encountered: