Search This Blog

2023/09/10

useUnknownInCatchVariables flag in tsconfig.json

There is flag called useUnknownInCatchVariables in tsconfig.json


where it is set to true


try {
var res = 5 / 3
} catch (err) {
console.log(err.message);
}


there err variable in catch block is of type unknown
if set to false then it is of type any.

No comments:

Post a Comment