Author : MD TAREQ HASSAN | Updated : 2020/10/26

What is TypeScript?

Overview

TypeScript Overview Step 1

TypeScript Overview Step 2

Benefits of TypeScript

Static analysis

Static analysis means that regardless of whether you explicitly define types or not, TypeScript looks through your code, doing its best to guess or infer what type any given object could be. In other words, even though this is just plain old JavaScript, just using the code that is written, TypeScript is able to figure out that the type of the properties are strings/int/bool etc. and the abc() property is a function.

Declaration files

Declaration files == Type definition files

TypeScript allows you to have Declaration Files which are files that allow you to describe the shape of code that’s written in (for example) plain JavaScript. So, by referencing one of these files you tell TypeScript exactly how that JavaScript code or library you are using should be assumed to be “typed”.

See: https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html

DefinitelyTyped

The repository for high quality TypeScript type definitions.

We can use DefinitelyTyped: lid.d.ts and lib will be available to our app as if that lib were written in TypeScript

In Visual Studio, drag and drop lib.d.ts, <reference path="lib.d.ts"> will be added