DEV Community

Discussion on: Moving from JavaScript to TypeScript

Collapse
 
dvddpl profile image
Davide de Paolis • Edited

I'd also like to stress this point.

Typescript is great but it's also a pain.

More stuff to write, more stuff to read, less flexibility, more complexity in compiling and running tests etc. overall more clutter and things that distract you from your main goal: write code to solve problems.

Use it wisely and when it makes sense.

Let it use inference, tell it to shut up (be it wit ts ignore or with any) when you are prototyping or jotting some poc implementations and so on.

Basically use type and interfaces when it helps making explicit the contracts/signature of methods and object talking to each others.
And don't create mega types or interfaces, use composition. Extend interfaces and use union types/type concatenation.

Collapse
 
kostyatretyak profile image
ะšะพัั‚ั ะขั€ะตั‚ัะบ

Typescript... overall more clutter and things that distract you from your main goal: write code to solve problems.

This can only be said by someone who doesn't actually use TypeScript. Although I agree that code in TypeScript is often much harder to read.

Thread Thread
 
dvddpl profile image
Davide de Paolis

We use typescript in some of our projects. so this opnionated statement comes from direct experience.
I am not denying that TS is useful, I am stating that it makes code too verbose - and long.

We as devs, have to find a balance between the clarity that comes from typization and the readability of the code itself. When i read code quickly to do a review, or to debug something, i want to be able to quickly read and grasp the underlying logic - TS is too me, too often, simply longer to read.