TypeScript, the nearly decade-old Microsoft project, increases in popular by the day. What is it?
Large-scale projects benefit most from the type safety. Our developers favor its minimal configuration management, well-integrated IDE support and its ability to refactor code safely and gradually adopt types.
- Less testing required: A typed language largely eliminates common unit and integration tests around parameters and return values. This also benefits the runtime: typings remove the need for libraries like
prop-types, resulting in smaller bundles.
Experienced and junior engineers alike want to use TypeScript: senior practitioners recognize its value, and newbies know of its increasing importance in the industry. Adopting this upcoming technology and training your company’s engineers on its use can be a big motivator in hiring and skill retention.
Applications written in TypeScript tend to be less prone to bugs, but there’s some additional benefits for large teams:
- Quicker on-boarding: Engineering resources shift drastically depending on the business’s needs: new teams form and existing teams change focus to ensure priority projects ship. TypeScript’s types serve as additional documentation on internal application state, data schemas, and data transformations of the program; types can help answer the ”why” questions that newcomers often have. Coupled with type safety, it helps newcomers confidently ship code.
- Accelerated development: Time to market is incredibly important at the enterprise level, and TypeScript can be a competitive advantage, as my team observed with Walmart’s Baby Registry.
- Manage technical debt: Enterprise software often contains feature-rich, long-lived code bases, a recipe that makes continued development increasingly difficult. TypeScript especially shines in large programs, where its safety mechanisms can guarantee new code doesn’t break the system and internal refactors don’t break public-facing interfaces. The act of adding types reveals similarities between disparate pieces of code, which can lead to useful refactors.
TypeScript can foster cross-team collaboration, an important yet often fleeting goal at companies with hundreds of engineers. This begins with a joint effort in typing the company’s microservices and APIs in reusable packages, and continues to community rewrites of shared code bases. A typed language also presents a more inclusive code base for practitioners of traditional enterprise languages (Java and C++): I’ve witnessed these engineers willingly contribute to TypeScript code bases.
Means of Adoption
TypeScript supports incremental on-boarding of projects, with increasing improvements in safety and developer ergonomics at each step. This favors teams adopting the technology at their own pace. A rough outline of how this looks:
- Installing and configuring the compiler
- Opting into stricter checks
- Progressively removing loose type definitions
TypeScript adoption becomes easier for application teams if the shared code layer (UI components, service clients, utility libraries, etc.) offer support via rich types: this ensures developers get all the advantages of building on a typed ecosystem without the additional burden of handling these types in each code base. Rewriting shared code in TypeScript is preferred: it ensures accurate types for consumers and will guaranteed surface a host of bugs in the common layer.
Enthusiastic about TypeScript? Great news: we’re hiring in Portland, Oregon. Check out our job listings on careers.walmart.com or shoot me an email for more details.