DEV Community

Cover image for Typescript vs Javascript
Jordan Jaramillo
Jordan Jaramillo

Posted on

Typescript vs Javascript

It is common to misunderstand Typescript and Javascript as if they were similar, which is why this tutorial will see the significant differences so that you can have a clear idea about these two languages.

What is Javascript?

JavaScript is a programming or scripting language that allows you to implement complex functions on web pages, every time a web page does more than just sit there and display static information for you to see, it displays timely content updates, interactive maps , 2D/3D Graphics animation, scrolling video player machines, etc, you can bet Javascript is probably involved. It is the third layer of the cake of standard web technologies, two of which (HTML and CSS) we have covered in much more detail in other parts of the Learning Area.

What is Typescript

TypeScript es un lenguaje de programación fuertemente tipado que se basa en JavaScript, lo que le brinda mejores herramientas a cualquier escala.

Some key features include:

  • Typescript is compatible with all JavaScript libraries and frameworks. Angular, a JavaScript framework used to build single-page applications, is entirely written in Typescript.

  • With an increase in code complexity, JavaScript had to meet OOP requirements; thus, that led to the introduction of Typescript.

  • Typescript helps with faster code development, thus improving performance.

All code in Javascript is fully valid Typescript code.

Advantages of Typescript over Javascript

There are some improvements with Typescript that give it an edge over Javascript. Here is the list of advantages of Typescript over Javascript.

At the time of development, Typescript introduces the compilation problems. This reduces the chances of runtime errors.

Typescript is strongly typed or allows static typing. This means that Typescript allows you to check the correctness of the type at compile time. This in JavaScript, is not possible.

TypeScript is nothing more than JavaScript with additional functions, that is ES6 functions. Some of these features are as follows:

  • Interfaces
  • Generic
  • Namespaces
  • null check
  • Access Modifiers

The team that develops some of the most popular open sources use Typescript for the development of these libraries. One of the most popular examples is Angular.

This means that most of the documentation and examples of these frameworks, mainly Angular, are written with Typescript. Eventually this means that the applications that are developed using these libraries are made with Typescript.

Angular is perhaps the most prominent example, practically all applications in Angular are written using Typescript, if you want to understand the framework thoroughly, you need to know Typescript.

Conclusion and my personal opinion

Learning Typescript introduces you to an amazing programming language, with even better development tools. Particularly Visual Studio Code will offer an interesting number of improvements to your development flow. Personally, this has helped me a lot to reduce my work times and the detection of errors increases drastically.

The amazing thing about using Typescript is that you can quickly configure it in your project, most frameworks allow you to install a Typescript boilerplate where you will get everything configured automatically.

This magnificent language is also supported by gigantic companies that are implementing it and also Microsoft who keeps it updated, so much so that it appears on the list of the most demanded languages in recent years.

So, what are you waiting for to learn it?

Image taken from https://tsh.io/

Top comments (2)

Collapse
 
joelbonetr profile image
JoelBonetR 🥇

There are two ways you can use TypeScript, do you know both?
Check this out! 😄

Collapse
 
jordandev profile image
Jordan Jaramillo

thanks for this contribution