How Dashlane Improved Code Quality with TypeScript
We Catch Errors Early
Programmers are human, and will make mistakes when writing code. What matters is being able to catch these mistakes early on, ideally long before the code is deployed to the end user. TypeScript has one big advantage over vanilla ES5/ES6: it allows the programmer to catch a lot of errors at compile time, instead of allowing them to happen at runtime. Take the example of
number has no
toUpperCase() method. The shortened feedback loop introduced by the static type system is invaluable in improving stability in your application: nobody wants their client-side or server app to crash at runtime!
Every big project requires refactors as the project progresses, to make the integration of a new feature easier, introduce some changes to the data model of the program, or simply clean up old code. Big refactors in the codebase are much easier when using TypeScript, because the compiler will give you an immediate overview of what your changes have broken. Most importantly, it will do so across the whole codebase. Say you change a function signature – the compiler will output an error for every call site, allowing you to fix all of them before pushing your changes out for review. Since we started using TypeScript, we’ve found that we were much more inclined to tackling big refactors, since we can rely on the compiler to do a lot of the grunt work for us. This means that we keep our codebases evolving continually, and are much better at avoiding code rot.
Improved Team Collaboration
Does your development team currently use TypeScript? Tell us about it! I’d love to know how and why your team uses TypeScript in the comments section below.
Sign up to receive news and updates about Dashlane
Thanks! You're subscribed. Be on the lookout for updates straight to your inbox.