catch 变量默认为 unknown(useUnknownInCatchVariables)

版本新特性 / TypeScript 4.4

// *** before: ***
try {
    doSomething();
} catch (e) {
    // e is implicitly any, even in strict mode
    console.log(e.message); // compiles, though e may be anything
}
function doSomething() {}

// *** in version 4.4: ***
// in strict mode (strict: true), with no annotation written
try {
    doSomething();
} catch (e) {
    // e: unknown - the new default
    // console.log(e.message); // <-Error: Object is of type 'unknown'
    if (e instanceof Error) {
        console.log(e.message);
    }
}