Byte-Sized Design

Byte-Sized Design

Share this post

Byte-Sized Design
Byte-Sized Design
šŸ“¦ Pinterest Migrated 3.7M Lines to TypeScript. Here’s How They Pulled It Off

šŸ“¦ Pinterest Migrated 3.7M Lines to TypeScript. Here’s How They Pulled It Off

A breakdown of Pinterest’s tooling, automation, and lessons from rewriting their frontend at scale

Byte-Sized Design's avatar
Byte-Sized Design
May 04, 2025
āˆ™ Paid
17

Share this post

Byte-Sized Design
Byte-Sized Design
šŸ“¦ Pinterest Migrated 3.7M Lines to TypeScript. Here’s How They Pulled It Off
6
Share

In eight months, Pinterest rewrote the backbone of their web infrastructure. Not for fun, but for survival.

They migrated 3.7 million lines of code from Flow to TypeScript in a single coordinated rollout. It was a systemic transformation touching everything from CI pipelines to how internal pages were routed and served.

Let’s break down the strategy, the landmines, and what you can steal from their playbook.


🚨 TL;DR

Pinterest had used Flow for typed JavaScript since 2016. By 2023, that decision aged out: Flow stagnated, TypeScript won the ecosystem, and hiring Flow developers became painful.

They pulled off the migration using a ā€œbig bangā€ approach, with aggressive automation, battle-tested codemods, and airtight testing. The result: a better developer experience, faster builds, fewer type bugs and a TypeScript codebase that scales.

They’ve open-sourced their tools and shared lessons. If you’re still on Flow (or stuck on legacy tech), this is the blueprint.


🧭 Why They Chose TypeScript

Pinterest didn’t switch because Flow was broken they switched because TypeScript offered tangible advantages across the board:

  • Hiring: TS skills are everywhere. Flow? Almost nowhere.

  • Tooling: TypeScript support in editors, linters, and language servers is miles ahead.

  • Ecosystem: OSS libraries and community tooling now assume TypeScript.

  • Language Features: TS supports conditional types, inference tricks, and const assertions that Flow simply doesn’t.

  • Momentum: Even Meta is leaning more into TypeScript. The writing was on the wall.

Pinterest had achieved 100% Flow coverage, meaning no gradual transition left. It was all or nothing.

Over time, TypeScript became the industry’s go-to, a shift clearly visible in its dominance across npm download stats.


Similar posts we’ve written in the post on the topic of large scale migrations:

šŸ—ļø How Quora Migrated a Decade of Redshift to Trino (and Lived to Tell the Tale)

šŸ—ļø How Quora Migrated a Decade of Redshift to Trino (and Lived to Tell the Tale)

Byte-Sized Design
Ā·
Apr 26
Read full story
Modernizing Legacy Systems Without Breaking Production

Modernizing Legacy Systems Without Breaking Production

Byte-Sized Design
Ā·
Jan 5
Read full story
How Slack Rebuilt a Critical System Without Stopping the World

How Slack Rebuilt a Critical System Without Stopping the World

Byte-Sized Design
Ā·
Apr 2
Read full story

šŸ—ļø Planning a Big Bang Migration

This project was a structured replacement, one where every file was transformed, tested, and reconnected to the wider ecosystem.

They split the work into three key phases:

  1. Setup – Get the TypeScript compiler, linters, and build tooling ready

  2. Conversion – Use codemods to transform Flow syntax to TypeScript

  3. Integration – Update every system that assumed .js, from test runners to internal page routing

Every step had its own edge cases. Every subsystem had assumptions that now broke.


āš™ļø Converting Millions of Lines (Without Going Insane)

Keep reading with a 7-day free trial

Subscribe to Byte-Sized Design to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
Ā© 2025 Byte-Sized Design
Privacy āˆ™ Terms āˆ™ Collection notice
Start writingGet the app
Substack is the home for great culture

Share