FirebaseError有一个"代码"属性,但是如何在promise的catch方法中读取它?以下引发TypeScript错误:Property 'code' does not exist on type 'Error'.
this.af.database
.object(`/some/path`)
.set(newObj)
.then(data => {
console.log('success');
})
.catch(err => {
// Property 'code' does not exist on type 'Error'.
console.log(`code`, err.code);
});
Run Code Online (Sandbox Code Playgroud)