Typescript 这个类型脚本语法是什么?

Typescript 这个类型脚本语法是什么?,typescript,Typescript,偶然发现了以下代码: const { operator } = this; 从 这是什么意思?这是。这个 相当于 const operator = this.operator; const other = this.other; 它是从ES6借来的,ES6有。有什么理由不只是写const operator=this.operator?不是真的,在这种情况下,我认为用正常的方式来做会更具可读性。也许作者只是想玩新功能@AlexeyVagarenko如果您需要从中获取属性,则需要编写多行关于获取

偶然发现了以下代码:

const { operator } = this;

这是什么意思?

这是。这个

相当于

const operator = this.operator;
const other = this.other;

它是从ES6借来的,ES6有。

有什么理由不只是写
const operator=this.operator?不是真的,在这种情况下,我认为用正常的方式来做会更具可读性。也许作者只是想玩新功能@AlexeyVagarenko如果您需要从
中获取属性,则需要编写多行关于获取的内容。因此,ES6提供了
解构功能
很容易在一行中编写。
const operator = this.operator;
const other = this.other;