TypeScript

TypeScript is a free and open source programming language developed by Microsoft . It is a superset of JavaScript , essentially adding static typing and class-based objects to orient JavaScript to objects entirely. Anders Hejlsberg , C # designer , has worked on TypeScript development TypeScript extends JavaScript syntax, so any existing JavaScript code should work fine. It is intended for large projects, which through a TypeScript compiler are translated into original JavaScript code. It also allows famous JavaScript libraries to work without problems such as JQuery , MongoDB ,Node.js , and D3.js .

Summary

[ hide ]

  • 1 Features
  • 2 Ways we can use it
  • 3 Advantages It Offers
  • 4 References

characteristics

It is mainly characterized by implementing the advantages of an object-oriented language and the advantages of JavaScript, allowing us to use both at the same time (we could write half in JavaScript and the other in TypeScript’s own language) and of course the code that we had. JavaScript will not be altered, so you will not need to modify any library.

This programming language is especially suitable for developing projects of a certain size, taking into account the integration with different editors and IDEs . Adds type checking, allowing you to use IntelliSense to facilitate development using Visual Studio.

TypeScript, of course, is open source and they offer tools to integrate the programming language into different tools ( Visual Studio , Sublime Text , Vi and Emacs), as well as a package for Node.js. The features that TypeScript adds to JavaScript development are small, but there are big benefits for .NET developers, who are familiar with similar features in the languages ​​they use for regular Windows application development.

TypeScript is not a magic bullet and it does not claim to be. But for anyone who is unsure about using JavaScript, TypeScript is a great language that can make the process easier.

Ways we can use it

We can use TypeScript in several very simple ways:

  • Install in Node.js:to install it, we just have to enter the following command to install the extension npm install -g typescript and later to compile it we will use tsc [File name] .ts.
  • Use the tools in Visual Studio 2012: Microsoft gives us the option of using the editor with specific tools by giving us a plugin that we can download from the official TypeScript page.
  • Use the tools in Sublime Text, Emacs and Vim:they have not forgotten about the people who do not use or prefer not to use Virtual Studio, and they give us the option to install the plugin in our favorite editor.
  • Online editor:on the official TypeScript website we can also find an instant editor and compiler that works perfectly.

Advantages offered

  • This is a superset of JavaScript
  • Each TypeScript program has its corresponding in JavaScript and vice versa
  • Optionally, you can provide source mapping for debugging
  • It already includes proposals given for ECMAScript in its version 6 –the last one approved is version 5.1-, such as classes and modules –see below-
  • It already includes type inference in the declaration of variables and functions. It would be one of the backbones of the new language – note its own name-
  • Defines environment declarations that are visible in the scope of the TS file, but are not propagated in the corresponding JS file, in order to be assimilated to explicit declarations in browsers or in specific libraries, such as JQuery
  • The language itself is loosely typed – typed, if you prefer – and declarations are allowed at runtime, so it does not adhere to a rigidity of declarations such as in C # or Java
  • A module is a completely anonymous object, everything inside it will be hidden from the outside world, unless it is made explicitly visible. Inside you can define variables, functions, objects, classes and interfaces. In the corresponding JS file they will be translated into components of an encapsulated object
  • An interface is a set of type declarations, with no content implementations; for example declarations of simply the type of variables and functions – but only that, the type. They are of exclusive validity at compilation time and their main utility lies in the documentation and validation of the correct typing – or typing – of the declarations of variables, functions, …
  • The class support covers a lot of what you would expect – within its simplicity, which is not the time to discuss – inheritance, public and private accessibility and overload, basically.

 

Leave a Comment

Scroll to Top