DEV Community

Muhammad Mutasim Hussain.
Muhammad Mutasim Hussain.

Posted on

Typescript

I am exploring Typescript for a big team project. From my point of view, typescript is a static type language. It reduces our error in development. It shows the error before compiling.
If the state will receive any string then we need to define the type string or if the state will receive any string array we need to define the type like this way string[ ]. Besides, adding comments to Prop types also adds more readability when you check a component definition.
We need to define the types for states and components props. When we send props we need to define the type that recovers component which value we will receive from it. By default, all the values are any which is not recommended to use it.

TypeScript is very helpful while using IDEs such as Visual Studio, Visual Studio Code, Atom, Webstorm, Eclipse, and so many more. These provide better autocomplete and snippet generation, which makes development faster.
The benefit of using TS is we can reduce the errors also we can understand our codes easily sometimes we code but we don't know how it works so TS removes this confusion because a developer knows what types of state he/she passes and receive what will do using it.
The problem is it is very time costing to define the types for every unique state.
TypeScript allows you gradually adapt its usage in your existing projects. You can also configure the TypeScript compiler for this use case. Find a list of TypeScript compilers in the official TypeScript documentation.

Top comments (0)