DEV Community

Discussion on: Do you use TypeScript with projects only you will touch?

Collapse
 
nikfp profile image
Nik F P

Always, unless it's literally a 10 line scratch file to test something.

I find that on anything I work on that is non-trivial, it's much easier to take the time to get the TS right on object types and function inputs and output, and then use the type system later when I consume those same types. It means less mental overhead for me, and ultimately I move faster as a result.

I see a lot of people taking issue with the need to write out interfaces and types. I find that using the type inference system and utility types that TS provides gets me around about 80% of that, so in the end I'm really only specifying types for function inputs and that's about it. Output types are inferred, so if I make a breaking change in a function the TS compiler yells at me where I use it, and I know to fix the issue or fix it where it's implemented.