JavaScript – start with TypeScript .

About TypeScript is an open-source language and compiler that runs both in the browser  -through SystemJS and on NodeJS.
Is developed by Microsoft, like an open-source language and compiler that runs both in the browser through SystemJS and on NodeJS.
Now TypeScript compiles to clean, simple JavaScript code.
You can runs on any browser, in Node.js, or in any JavaScript engine that supports ECMAScript 3 (or newer).
There are two main ways to get TypeScript tools:

  • using npm (the Node.js package manager)
  • or installing TypeScript’s Visual Studio plugins

The easiest way to get started with TypeScript is through the TypeScript playground found on the TypeScript website play.
The TypeScript version 2.4 has already introduced dynamic import expressions, safer callback parameter checking, weak types, and string enums.
About dynamic import expressions then allow users to asynchronously request a module at any arbitrary point in your program.
The string enums allow enum members to contain string initializers.
Allow to return types as inference targets can now make inferences for the return type of a call.
To get started with the latest stable version of TypeScript, you can grab it through NuGet with:

You can use the following command with npm:

You can download it from the official website.
To compile it use this:

Now, let’s install it and try it.
First use git command to put into your computer:

Make a file named ts_es001.ts and use this command:

The result will be ts_es001.js file.
Create your ts_es001.html file with this content:

This is the most simple example of using typescript tool with node.js.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.