JavaScript with TypeScript 2.1

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.


Comments

Popular posts from this blog

Apps with Mobile Roadie, the one-stop platform

Towards cross-platform development..

Installing Android Studio 3.0 on Windows 10