Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Yelp Engineering 11 min read Case study mediumAdept

Migrating a Large Flow Monorepo to TypeScript

Yelp migrated 1.4 million lines of Flow-typed JavaScript in a Lerna monorepo to TypeScript over three and a half years, converting one package at a time without ever bulk-disabling typechecking. Packages were converted bottom-up with flowts (later Stripe's flow-to-typescript-codemod), and flowgen turned the generated .d.ts files back into Flow headers so unconverted Flow code still typechecked against them. A dependency-graph importance score, Graphviz visualizations, auto-filed Jira tickets and quarterly deadlines kept the long tail moving. The result was 96.44% type coverage versus 83.15% under Flow, about 6,000 @ts-expect-error directives, and 82% of surveyed engineers reporting higher productivity. Early-2023 LLMs and cron-driven auto-conversion did not prove reliable enough to use.

Related posts

  • Migrating from Apollo Tooling to GraphQL Codegen at Yelp

    Yelp Engineering mediumAdept

    Yelp replaced the deprecated apollo-tooling codegen with GraphQL Codegen across a 500+ package React/TypeScript monorepo without requiring developers to change imports or queries. Rather than adopting gql.tada or Codegen's native client preset, the team patched the typescript-operations plugin and near-operation-file preset to emit apollo-tooling-compatible output: per-operation file names, inlined enums and input types, plain `T | null` instead of Maybe/Exact wrappers, and field-only nested type names. The patches also fixed a concurrency problem where multiple processes regenerated shared fragments. The changes were upstreamed into GraphQL Codegen v6 in collaboration with its maintainer. The remaining few hundred type errors were fixed incrementally, with Claude's help, using a shrinking allowlist of packages still on the old tool.

  • The evolution of Figma’s mobile engine: Compiling away our custom programming language

    Figma mediumAdept

    Figma migrated its prototype viewer's mobile engine from Skew, an in-house compile-to-JavaScript language, to TypeScript using a custom Skew-to-TypeScript transpiler and a three-phase rollout (write/build Skew, write Skew/build TypeScript, write/build TypeScript) that never paused development. The move became viable once mobile WebAssembly support let hot paths move to the C++ engine, removing the need for Skew's optimizing compiler. Transpiler pitfalls included slow JavaScript array destructuring (direct indexing improved per-frame latency by up to 25%), behavior differences from Skew's devirtualization that broke Smart Animate on null receivers, and TypeScript's initialization-order rules. Source maps were maintained so developers could keep debugging throughout.

  • How to Write Code Without Having to Read It

    Shopify Engineering mediumAdept

    Engineers can safely change unfamiliar code with minimal reading by letting the compiler, linter and unit tests guide them: locate the entrypoint via user-visible strings (or git bisect for regressions), make the breaking change at the leaf component, then climb the callstack following build errors and sweep back down via lint errors, exhaustive switches and test failures. To make code easier for the next "non-reader," replace comments with enforced checks, wrap primitives in custom types, merge dependent arguments into tagged unions, nested objects or enums, and split decision logic into pure functions so unit tests stay simple. Examples use React Native and TypeScript but the approach generalizes to any typed, tested codebase.

  • From Ruby to Node: Overhauling Shopify’s CLI for a Better Developer Experience

    Shopify Engineering mediumAdept

    Shopify rewrote its CLI from Ruby to TypeScript on Node to reduce system requirements, unify the Theme, App and Hydrogen workflows, and stay easy for internal teams to contribute to. Go and Rust were rejected despite their static binaries because few Shopify engineers know them. Node won over Ruby because its module system lets multiple versions of a transitive package coexist, which supports modular plugins. The new architecture rests on a shared @shopify/cli-kit package, custom ESLint rules, cross-OS CI testing, a monorepo, and a functional, MVC-like split of models, commands and services. It also uses Vitest unit tests, Cucumber E2E tests, and oclif plugins with hooks for dependency inversion.

  • How we use Web Components at GitHub

    GitHub Engineering mediumAdept

    GitHub moved from jQuery to native Web Components starting in 2014 and now ships dozens of custom elements such as <include-fragment>, <details-dialog> and <relative-time>. Engineers author components in the Rails monolith with Catalyst, a TypeScript decorator library, paired one-to-one with ViewComponent on the server, and enforce practices with ESLint plugins and ratchet tests that block deprecated patterns like facebox. Proven components are generalized, stripped of Catalyst and published as dependency-free, style-free open-source elements with TypeScript definitions. One example is <typing-effect>, built in under 40 lines to avoid a fivefold bundle-size increase from typed.js.

The quest for software engineering knowledge.

Look:
Layout: