在Typescript to version 4.4配置中添加了useUnknownInCatchVariables属性,默认值为true
try {
...
} catch(e) {
console.log(e.message) //报错Object is of type 'unknown'
}
解决:
try {
...
} catch(e) {
console.log((e as Error).message)
}
在Typescript to version 4.4配置中添加了useUnknownInCatchVariables属性,默认值为true
try {
...
} catch(e) {
console.log(e.message) //报错Object is of type 'unknown'
}
解决:
try {
...
} catch(e) {
console.log((e as Error).message)
}
2024-11-30 11:11:42
2024-11-30 11:11:42
2024-11-30 11:11:41
2024-11-30 11:11:41
2024-11-30 11:11:40
2024-11-30 11:11:40
2024-11-30 11:11:39
2024-11-30 11:11:39
2024-11-30 11:11:39
2024-11-30 11:11:38