DEV Community

Ali Haydar
Ali Haydar

Posted on

Typescript

Typescript

Typescript: Microsoft created and maintains TypeScript, an open-source programming language. It is a strict syntactical superset of JavaScript that extends the language with optional static typing. TypeScript is intended for large-scale application development and trans compiles to JavaScript.

Why is Typescript called the SuperSet of Javascript ?

A superset is a set that contains another set. Because JavaScript is a dynamically typed language, there are no data types, which means no compile time errors. We always receive errors in JavaScript that say, "Cannot read property x of undefined." This is a problem that Typescript solves. It adds type-checking to your JavaScript code. Typescript is a superset in the sense that you can write legitimate JavaScript without using any of the extra features Typescript provides. The main purpose of Typescript is to provide static type-checking to your JavaScript code and to provide extra functionality that the existing JavaScript standard does not provide.

TypeScript vs. JavaScript What Is the Difference Between JavaScript and TypeScript?

If you've ever worked on a web development project, you've probably come across JavaScript. For many web-based projects, JavaScript is presently the most popular programming language.

TypeScript is an open-source programming language that is well-suited for large-scale applications. Microsoft created TypeScript in 2012 because the code of JavaScript was becoming more sophisticated when it came to large-scale web applications.

As a result, changing the JavaScript (.js) extension to TypeScript (.ts) will have the same effect. However, this does not imply that JavaScript and TypeScript are interchangeable.

TypeScript has the following features:

To make TypeScript code comprehensible by browsers, it is translated to JavaScript: Because browsers cannot understand a single line of TypeScript code, the written code is compiled and then transformed to JavaScript code, which browsers can understand and use. This is referred to as trans-piled.

TypeScript code can be found everywhere: TypeScript code can be run on any operating system, browser, or device. The code is not tied to any particular operating system or engine.

JavaScript to TypeScript: It is quite simple to convert code from JavaScript to TypeScript. Simply changing the extension from.js to.ts converts a javascript code type to a TypeScript code type.

Library Support: TypeScript supports the JS library, allowing developers to quickly access JavaScript libraries without having to construct libraries specifically for TypeScript.

Image description

Top comments (0)