DEV Community

Discussion on: 13 Typescript Utility: A Cheat Sheet for Developer

 
thethirdrace profile image
TheThirdRace

I know it's a controversial opinion, but personally I think that if you're very good, you don't actually need typings or tests.

Typings and tests will slow you down on delivering your code. There's nothing to argue here:

Which is faster?

  1. Spend time on something
  2. Don't spend time at all

But you're not doing these for you, or at least not for the current you.

Typings and tests will make future you much faster to put yourself back in context and pickup where you left up. Both are an incredible time saver for future you.

And as soon as you add another developer or a team to the mix, typings and tests will make things much smoother for everyone.

Tests are the 1st par of the equation. They will show the intended use of the code.

Typings are the 2nd part of the equation. They will provide intellisense in your code editor and provide a safety net before wasting 20 minutes while your tests run.

Which is faster?

  1. Find the correct test > open it > analyze it > reproduce it > wait 20 minutes for the tests to complete >repeat if there's a failure
  2. Your code editor automatically give you all the information needed without having to think at all > get instant feedback if you're doing something wrong

Typings absolutely brings a lot to the table. They're not a replacement for tests either, both are needed to really give your team a boost.

You don't have to create over-complicated typings, you just need to describe the inputs and outputs of your function so that others can see at a glance how to use your function.

In any case, if this doesn't convince you, well I simply hope you will keep this in mind. Sometimes, it takes time for it to just "click" in place.

Have a good day!