Optional catch clause variables

Thanks to work done by @tinganho, TypeScript 2.5 implements a new ECMAScript feature that allows users to omit the variable in catch clauses.For example, when using JSON.parse you may need to wrap calls to the function with a try/catch, but you may not end up using the SyntaxError that gets thrown when input is erroneous.

  1. let input = "...";
  2. try {
  3. JSON.parse(input);
  4. }
  5. catch {
  6. // ^ Notice that our `catch` clause doesn't declare a variable.
  7. console.log("Invalid JSON given\n\n" + input)
  8. }