Skip to Content
Effective TypeScript, 2nd Edition
book

Effective TypeScript, 2nd Edition

by Dan Vanderkam
April 2024
Beginner to intermediate
404 pages
10h 6m
English
O'Reilly Media, Inc.
Content preview from Effective TypeScript, 2nd Edition

Chapter 10. Modernization and Migration

You’ve heard that TypeScript is great. You also know from painful experience that maintaining your 15-year-old, 100,000-line JavaScript library isn’t. If only it could become a TypeScript library!

This chapter offers some advice about migrating your JavaScript project to TypeScript without losing your sanity or abandoning the effort.

The less code you have, the easier it will be to migrate. So it’s a good idea to remove deprecated features and do a round of dead code elimination before you start a TypeScript migration. You may want to hold off on other forms of modernization, however: converting a jQuery web app to React will actually be much easier once you’ve adopted TypeScript.

Only the smallest codebases can be migrated in one fell swoop. The key for larger projects is to migrate gradually. Item 81 discusses how to do this. For a long migration, it’s essential to track your progress and make sure you don’t backslide. This creates a sense of momentum and inevitability to the change. Item 82 discusses ways to do this.

Migrating a large project to TypeScript won’t necessarily be easy, but it does offer a huge potential upside. A 2017 study found that 15% of bugs fixed in JavaScript projects on GitHub could have been prevented with TypeScript.1 Even more impressive, a survey of 6 months’ worth of postmortems at Airbnb found that 38% of them could have been prevented by TypeScript.2 If you’re advocating for TypeScript at your organization, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming TypeScript

Programming TypeScript

Boris Cherny

Publisher Resources

ISBN: 9781098155056Errata PageSupplemental Content