What is Typescript? Why prefer Typescript over Java Script for Large Application?

Tapendra Dev
3 min readNov 15, 2019

Typescript is a modern age Javascript development language. It is a statically compiled language to write a clear and simple Javascript code. It can be run on Node js or any browser which supports ECMAScript 3 or newer versions.

Typescript provides optional static typing, classes, and interface. For a large JavaScript project adopting Typescript can bring you more robust software and easily deployable with a regular JavaScript application.

Features of TypeScript

TypeScript is just JavaScript. TypeScript starts with JavaScript and ends with JavaScript. Typescript adopts the basic building blocks of your program from JavaScript. Hence, you only need to know JavaScript to use TypeScript. All TypeScript code is converted into its JavaScript equivalent for the purpose of execution.

TypeScript supports other JS libraries. Compiled TypeScript can be consumed from any JavaScript code. TypeScript-generated JavaScript can reuse all of the existing JavaScript frameworks, tools, and libraries.

JavaScript is TypeScript. This means that any valid .js file can be renamed to .ts and compiled with other TypeScript files.

TypeScript is portable. TypeScript is portable across browsers, devices, and operating systems. It can run on any environment that JavaScript runs on. Unlike its counterparts, TypeScript doesn’t need a dedicated VM or a specific runtime environment to execute.

In addition to this, TypeScript

  • Is purely object-oriented programming
  • Can be used for client-side and server-side development alike
  • Offers a “compiler” that can convert to JavaScript-equivalent code
  • Has an API for DOM manipulation
  • Has a namespace concept by defining a “Module”

Technology Decoupling

TypeScript is a superset of JavaScript. TypeScript generates JavaScript code that is easy to read and debug, and that looks very much like the original TypeScript code. This means that if (for any reason) you wish to return to plain JavaScript, you can take the generated JavaScript and work with it directly. In other words, there is no dependency on TypeScript, so it is easy to stop using it.

Type Safety

As the name suggests, TypeScript is a strongly typed language, and type safety is the most important added value that TypeScript offers. When creating a small to medium JavaScript application with one or two developers, it’s OK to go without any type of safety. But when the application grows, that growth might lead to messy code that is very hard to maintain and debug.

Conclusion

If you haven’t tried TypeScript yet, I strongly recommend you give it a try specially if you are dealing with Complex Web Apps. As a JavaScript developer, it’ll provide you with some capabilities that will make your job easier. It has Less horrible debugging and less silly errors should end up saving you some precious time.

--

--

Tapendra Dev

Founder & CEO of Secure Blink — Heuristic AppSec Management Platform | Cybersecurity Researcher | Serial Entrepreneur