[TypeScript@2.5] Omit catch error block if not needed

From TypeScript@2.5, you can omit catch error block.

Before:

try {
  throw new Error('whatever');
} catch(err) {
   console.log(err)  
}

Now:

try {
  throw new Error('whatever');
} catch {
   console.log("error happened")  
}

It is just a syntax sugar, if you are not trying to do error handling

原文地址:https://www.cnblogs.com/Answer1215/p/7487385.html