這是什麼 TypeScript 語法?
偶然發現這段程式碼:
const { operator } = this;
來自 https://github.com/ReactiveX/rxjs/blob/master/src/Observable.ts#L89
這是什麼意思?
答案#1
這是物件解構。這
const { operator, other } = this;
等同於
const operator = this.operator;
const other = this.other;
它借鑒自 ES6,具有相同的特性。
