I am having problems when defining a lambda function that accepts an optional parameter. The strange part is that if I use the full "function" syntax the anonymous function works, but the lambda shorthand/arrow syntax produces errors such as the following:
- The name 'a' does not exist in the current scope
- Supplied parameters do not match any signature of call target
- Expected ')'
Example:
(function (a, b?) => { console.log(a, b); })("a"); // OK
((a, b?) => { console.log(a, b); })("a", "b"); // Errors
((a, b) => { console.log(a, b); })("a", "b"); // OK