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

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[TypeScript@2.5] Omit catch error block if not needed相关的知识,希望对你有一定的参考价值。

From [email protected], 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

以上是关于[TypeScript@2.5] Omit catch error block if not needed的主要内容,如果未能解决你的问题,请参考以下文章

[TypeScript] Type check JavaScript files using JSDoc and Typescript 2.5

R语言na.omit函数删除NA值实战

ignore,neglect,omit,overlook

为啥`-fno-omit-frame-pointer` 会干扰 ASAN?

Elasticsearch:何时将 omit_norms 选项设置为 false

使用参考时,Typescript Omit 不显示错误