Closed
Description
In TypeScript 4.0, we allowed users to to annotate catch
variables with : unknown
; however, it'd be nice if we could have that be the default.
I could imagine a flag like --useUnknownInCatchVariables
to switch the default type to be unknown
.
// @useUnknownInCatchVariables: true
try {
// ...
}
catch (e) {
e.toUpperCase(); // error
}
Alternatively, I could also imagine a much broader flag that also types parameters as unknown
as well.