【发布时间】:2017-03-02 15:17:47
【问题描述】:
FirebaseError has a "code" property,但是如何在 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);
});
【问题讨论】:
标签: angular typescript firebase angularfire