Alexey Vagarenko
Alexey Vagarenko

Reputation: 1196

What is this typescript syntax?

Stumbled upon this code:

const { operator } = this;

from https://github.com/ReactiveX/rxjs/blob/master/src/Observable.ts#L89

What does it mean?

Upvotes: 3

Views: 81

Answers (1)

Nick H
Nick H

Reputation: 11535

It's object destructuring. This

const { operator, other } = this;

is equivalent to

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

It's borrowed from ES6, which has the same feature.

Upvotes: 4

Related Questions