DEV Community

Discussion on: Convince me that types are awesome

Collapse
 
bradtaniguchi profile image
Brad • Edited

When I first started programming I thought dynamic languages were faster to program in. That was until I had a decently sized project and had no idea what the hell was going on.

  1. Developing with types gives you better documentation at your fingertips since types provide better context, and auto-completion.
    • Its easier to write code
  2. Developing with types gives you more fail-safes in your code
    • Your code gets harder to screw up
    • Etc. Typos/invalid arguments/invalid syntax all explodes at the time of writing, rather than at run-time.
  3. Developing with types gives you more fail-safes when using external code
    • More reliable interactions between your code and libraries
    • Ex. Version 3 of the package had breaking changes, all you code now explodes at compile time, rather than at run-time.
  4. Refactoring massive projects becomes stupidly easy to handle.
    • Cleaner, safer, faster code refactors
    • Ex. Rename a User object's name property to fullName is as easy.
  5. Projects don't fail because "you don't write code fast enough" they may fail because you can't update your code easily enough, or your code is a mess
    • Typescript allows you to iterate on existing code faster, and safer, resulting in saved $$$
    • (see refactor example)
  6. Your probably already using some typechecking/typescript via VSCode's built in typechecking features

Make the code work for you, don't work for the code!