Kris Guzman
1 min readMar 16, 2020

--

Maybe I should have phrased it, “manual typing is generally not ideal”.

Writing & managing types for your component props is no big deal.

Writing & managing types for your custom functions is no big deal.

Writing & managing types for an API is error prone and a big deal (but often necessary).

Writing & managing types for a 3rd party library is a big deal (not as common, but it does happen more often than it should).

I made a blanket statement to get a point across. The more types you’re writing yourself, the more time you’ll generally spend managing those types, especially for something that changes often like an API.

The entire purpose of API type generators, and libraries shipping with type definitions, is to avoid these major scenarios.

Why? Because writing manual types is time consuming and error prone. I know it sounds like a blanket statement, but it’s kinda true in most cases. The beauty of TypeScript and Flow is that while it enforces types, it is great at inferring types as well. This is intended so you and I don’t have to constantly write types for everything,

Do you have an example of when manual types are beneficial?

--

--

Kris Guzman
Kris Guzman

Written by Kris Guzman

Front end developer. On a mission to explore the world & build amazing software. Connect with me on LinkedIn: https://www.linkedin.com/in/kristopher-guzman/

No responses yet