Thursday, November 10, 2016

TypeScript 2.1 ready to go!


Microsoft's TypeScript (also regarded as industrial strength JavaScript)  is getting upgraded with new features:

Improved Inference
Async Functions


TypeScript 2.0 was released as recent as September 2016. TypeScript 2.1 is in RC (release candidate)

The upgrade makes modelling easier and migrating JavaScript to TypeScript easier. Aysnc/await () introduced in ECMAScript 2016  is featured in the new release and makes asynchronous programming easier. It shares same keywords in C#, Dart and Python.

Here is sample code from the msdn blog links above:
=====
async function main() {
 await ping();
}
async function ping() {
 for (var i = 0; i < 10; i++) {
  await delay(300);
  console.log(“ping”);
 }
}
function delay(ms: number) {
 return new Promise(resolve => setTimeout(resolve, ms));
}
main();
====
Read the rest of the story here if you are into programming with JavaScript.


No comments:

DMCA.com Protection Status