DEV Community

Fathe Karim
Fathe Karim

Posted on

Typescript

I am exploring Typescript for our team project. From my understood typescript is a static type language. It reduces our error in development.
We need to define the types for states and components props. When we send props we need to define the type that recover component which value we will receive from it. By default all the values are any which is not recommend to use it.
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[].
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 remove this confusion because a developer knows what types of state he/she passing and receive and what will do using it.
The problem is it is very time costing to define the types for every unique state.

Top comments (0)