Les Paul Les Paul - 1 month ago 21
TypeScript Question

Angular2 Typescript "= () =>"

Easy question for someone to answer, what happens in this typescript function?

getTweetCount = () => this.data.totalCount;


data.totalCount is of type number from a service.

Answer

getTweetCount = () => this.data.totalCount;

You are creating an arrow function that returns this.data.totalCount.

More

Arrow functions : https://basarat.gitbooks.io/typescript/content/docs/arrow-functions.html

Comments