Typescript-An Overview

Typescript-An Overview
Techiio-author
Written by Debarghya DasDecember 10, 2021
10 min read
TypeScript
2 VIEWS 1 LIKES 0 DISLIKES SHARE
1 LIKES 0 DISLIKES 2 VIEWS SHARE
Techiio-author
Debarghya Das

Junior Front-End Developer

In this tutorial, you know about Typescript, what're its features, and its advantages and disadvantages.

About Typescript

TypeScript is a programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language. TypeScript is designed for the development of large applications and transcompiles to JavaScript. As TypeScript is a superset of JavaScript, existing JavaScript programs are also valid TypeScript programs.

TypeScript may be used to develop JavaScript applications for both client-side and server-side execution (as with Node.js or Deno). There are multiple options available for transcompilation. Either the default TypeScript Checker can be used. or the Babel compiler can be invoked to convert TypeScript to JavaScript.

blogpost

Why Use TypeScript?

TypeScript is superior to its other counterparts like CoffeeScript and Dart programming languages in a way that TypeScript is extended JavaScript. In contrast, languages like Dart, CoffeeScript are new languages in themselves and require language-specific execution environment.

The benefits of TypeScript include −

  • Compilation − JavaScript is an interpreted language. Hence, it needs to be run to test that it is valid. It means you write all the codes just to find no output, in case there is an error. Hence, you have to spend hours trying to find bugs in the code. The TypeScript transpiler provides the error-checking feature. TypeScript will compile the code and generate compilation errors, if it finds some sort of syntax errors. This helps to highlight errors before the script is run.
  • Strong Static Typing − JavaScript is not strongly typed. TypeScript comes with an optional static typing and type inference system through the TLS (TypeScript Language Service). The type of a variable, declared with no type, may be inferred by the TLS based on its value.
  • TypeScript supports type definitions for existing JavaScript libraries. TypeScript Definition file (with .d.ts extension) provides definition for external JavaScript libraries. Hence, TypeScript code can contain these libraries.
  • TypeScript supports Object Oriented Programming concepts like classes, interfaces, inheritance, etc.

Components of Typescript

At its heart, TypeScript has the following three components −

  • Language − It comprises of the syntax, keywords, and type annotations.
  • The TypeScript Compiler − The TypeScript compiler (tsc) converts the instructions written in TypeScript to its JavaScript equivalent.
  • The TypeScript Language Service − The "Language Service" exposes an additional layer around the core compiler pipeline that are editor-like applications. The language service supports the common set of a typical editor operations like statement completions, signature help, code formatting and outlining, colorization, etc.

Typescript Feature's

Following the Typescript Fetures given below:

  • Cross-Platform: TypeScript runs on any platform that JavaScript runs on. The TypeScript compiler can be installed on any Operating System such as Windows, macOS, and Linux.
  • Object-Oriented Language: TypeScript provides powerful features such as Classes, Interfaces, and Modules. You can write pure object-oriented code for client-side as well as server-side development.
  • Static type-checking: TypeScript uses static typing. This is done using type annotations. It helps type checking at compile time. Thus, you can find errors while typing the code without running your script each time. Additionally, using the type inference mechanism, if a variable is declared without a type, it will be inferred based on its value.
  • Optional Static Typing: TypeScript static typing is optional, if you prefer to use JavaScript's dynamic typing.
  • DOM Manipulation: Like JavaScript, TypeScript can be used to manipulate the DOM.
  • ES 6 Features: TypeScript includes most features of planned ECMAScript 2015 (ES 6, 7) such as class, interface, Arrow functions etc.

Advantages of Typescript

  • TypeScript features mistakes at arrangement time while JavaScript, at the runtime.
  • TypeScript gives the advantages of discretionary static composing: TS types can be added to factors, capacities, properties, and so forth.
  • TypeScript underpins specifically or static composing. Static composing can be valuable to help archive capacities, explain utilization, and diminish psychological overhead (interface type clues and getting expected mistakes continuously programming).
  • TypeScript runs in any program or JavaScript motor.
  • Extraordinary tooling with IntelliSense which gives dynamic clues as the code’s additional.
  • TypeScript helps in code organizing.
  • TypeScript has a namespace idea by characterizing a module.
  • TypeScript’s explanations can be discretionary.
  • TypeScript upholds interfaces.
  • TypeScript’s manager modules give a standout amongst other IDE engineer insight.
  • TypeScript has better documentation for APIs which is in a state of harmony with a source code. A few organizations report a decrease in bugs when they change to TypeScript.

Disadvantages of Typescript

  • TypeScript sets aside a long effort to incorporate the code.
  • TypeScript doesn’t uphold theoretical classes.
  • When utilizing an outsider library, there should be a definition document, and now and again it’s not generally accessible.
  • Nature of type definition documents is a worry.
  • At whatever point TypeScript needs to run in a program, there should even now be a gathering step to change TypeScript to JavaScript.
  • Enrolling TypeScript engineers may be a genuine annoyance, since a portion of the designers are not keen on learning TypeScript, being entirely alright with utilizing JavaScript. Groups that as of now use JavaScript, become profitable with TypeScript after around 2-3 months, and conversant in TypeScript simply after about a large portion of a year. So instructing staff can likewise be an obstacle.
  • TypeScript isn’t completely coexpressive with JavaScript. Missing highlights include: HOFs, Composition, Generics with Higher key.

Conclusion

TypeScript brings a lot of benefits to our productivity and developer experience.TypeScript is not unique to Angular, other powerful frontend frameworks such as React and Vue are starting to be used with TypeScript to allow developer teams to create applications that are reliable, sustainable and scalable. JavaScript and TypeScript are continually evolving but not competing against each other. TypeScript was created to complement and enhance JavaScript - not replace it. The future may see them becoming very similar in features but with TypeScript remaining the statically typed alternative.

Typescript
Javascript
2 VIEWS 1 LIKES 0 DISLIKES SHARE
1 LIKES 0 DISLIKES 2 VIEWS SHARE
Was this blog helpful?
techiio-price-plantechiio-price-plantechiio-price-plantechiio-price-plantechiio-price-plan
You must be Logged in to comment
Code Block
Techiio-author
Debarghya Das
Junior Front-End Developer
Techiio-followerTechiio-followerTechiio-followerTechiio-followerTechiio-follower
+4 more
74 Blog Posts
227 Discussion Threads
Trending Technologies
15
Software40
DevOps48
Frontend Development24
Backend Development20
Server Administration17
Linux Administration26
Data Center24
Sentry24
Terraform23
Ansible83
Docker70
Penetration Testing16
Kubernetes21
NGINX20
JenkinsX17
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance