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:
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
This is a bug in the compiler and is getting fixed right now [v0.8]. Lambdas currently give error messages with optional and rest parameters. Please use the long function syntax if this is a blocking issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With