在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-08-19 22:08:18
2024-04-16 17:04:40
2024-08-19 22:08:17
2024-08-19 22:08:17
2024-08-19 22:08:06
2024-08-19 22:08:06
2024-08-19 22:08:04
2024-08-19 22:08:57
2024-08-19 22:08:57
2024-08-19 22:08:54