typescript-this-explained
It should shed light on the - for some people - confusing behaviour of this
in TypeScript.
I've found out some time ago, that it is already consuing enough in plain JavaScript,
but TypeScript adds some more features with the arrow-notation for functions (() => {}
),
which can make it even more challengin. Especially for JavaScript and TypeScript beginners.
How to run it
after downloading the code run
npm install
npm start
this will install TypeScript in version 1.4, compile the script and run it.
If you want to play with index.ts
you can recompile and run it with npm start
.
The explenation is as comment inside the script.