Typescript vs JavaScript

Type Script History

What is JavaScript?

JavaScript is a scripting language and it helps us create interactive web pages. JavaScript followed rules of client-side programming. JavaScript is lightweight and mostly used as a part of web pages. JavaScript run in web browser without the need of any resources. It can also use with other technologies like XML, Rest API etc.

 What is Typescript?

Typescript is an object-oriented programming, as well as optional static typing to the JavaScript.  Typescript provides the functionalities of Object-Oriented Programming like class, Interface, Inheritance, Encapsulation etc.

 

Why JavaScript?

  • Open source project with Microsoft's patronage
  • Specially designed for small scripts
  • Supports interfaces, classes & modules.
  • Compiled JavaScript runs in all browser
  • Allows cross-compilation
  • JavaScript can extend for writing large apps as well
  • Added support for classes, interfaces, and modules

Why Typescript?

  • TypeScript supports API Documentation and JS libraries.
  • TypeScript is a superset of JavaScript
  • It is optionally typed scripting language
  • TypeScript code converted into plain JavaScript code
  • Better code structuring and object-oriented programming techniques
  • Allows better development time tool support
  • It can extend the language beyond the standard decorators, async/await

History of JavaScript

 Brendan Eich was created the JavaScript  in 1995 during his time at Netscape Communications.  JavaScript prototype was developed in 10 days. JavaScript first time used in  Netscape’s Navigator, which was one of the most popular web browsers

 

 

 

  • It was launched in September 1995, and It took just 10 days to develop this scripting language which was initially called Mocha
  • In November 1996, Netscape submitted JavaScript to ECMA (European Computer Manufacturers Association) International
  • ECMAScript 2 was released in 1998
  • ECMAScript 3 was released in 1999
  • Brendan Eich and Mozilla join ECMA to develop E4X Java script in 2005.
  • CommonJS project was launched in January 2009 with the aim of defining a common standard library
  • IECMAScript 5.1 was released in June 2011
  • ECMAScript 2016 was released in June 2015
  • The current version is ECMAScript 2017 which was released in June 2017

History of Typescript

 

  • Microsoft  was launched TypeScript version 0.8 for public in October 2012
  • TypeScript 0.9 was released in 2013.
  • TypeScript 1.0 was released in 2014 which support generic.
  • TypeScript came with new compiler in July 2014 which is five times faster than previous version
  • TypeScript support for ES6 modules, namespace keyword, for, of support, decorators in July 2015
  • Added features like key and lookup types mapped types, and rest in November 2016.
  • Added features like conditional types, the improved key with intersection types supports in March 2018.

Features of Javascript

  • Cross-platform language
  • Used for client side and server-side applications
  • Easy to learn.
  • Dynamic language, powerful and flexible.
  • Strong Testing Workflow
  • Added Dependencies
  • Framework Unsupported

 

Features of Typescript

  • Maintainability
  • Offered great productivity for developers
  • Code navigation and bug prevention
  • Code 'discoverability' & refactoring
  • Optional Static Type Annotation and Static Typing
  • Additional Features for Functions
  • Supports ES6
  • Supports interfaces, sub-interfaces, classes, and subclasses
  • Scalable HTML5 client-side development
  • Rich IDE available(Visual Studio Code, Atom, WebStorm  ect.) with autocomplete and code navigation features.
  • Support Class-based object-oriented.

 

What is better?

In the end, we can say that if an experienced developer is working on relatively small coding projects, then JavaScript is ideal. However, if you have knowledge and expertise development team, then Typescript is a most preferred option.

 

KEY DIFFERENCE

  • JavaScript is a scripting language which helps us to create interactive web pages whereas Typescript is a superset of JavaScript.
  • Typescript code needs to be compiled while JavaScript code doesn’t need to compile.
  • Typescript supports a feature of prototyping while JavaScript doesn't support this feature.
  • Typescript uses concepts like types and interfaces to describe data being used whereas JavaScript has no such concept.
  • Typescript is a powerful type system, including generics & JS features for large size project whereas JavaScript is an ideal option for small size project.