menu
techminis

A naukri.com initiative

google-web-stories
source image

Medium

1w

read

130

img
dot

Image Credit: Medium

Migrating 3.7 Million Lines of Flow Code to TypeScript

  • Pinterest successfully migrated 3.7 million lines of code from Flow to TypeScript in eight months, resulting in better type safety, developer experience, and improved hiring.
  • Initially, Flow was chosen for gradual adoption ease and React compatibility, but industry trends favored TypeScript for JavaScript type checking over time.
  • The migration process into TypeScript was divided into three phases: Setup, Conversion, and Integration.
  • They configured TypeScript, @typescript-eslint, and VS Code settings, resolving compatibility issues and optimizing ESLint with Discord’s fork.
  • Migration steps included converting dependencies like Apache Thrift, OpenAPI, and Relay types, running codemods, and suppressing ESLint errors.
  • Automation of the conversion process involved running codemods, fixing bugs, suppressing errors, and updating ESLint rules for TypeScript.
  • Integration focused on transpilation with Babel, updating JS filename references, and validating the migration through daily testing and manual rounds.
  • The rollout plan included isolating migration changes, minimizing developer disruption, and enabling quick recovery, leading to a successful transition to TypeScript.
  • The migration at Pinterest was incident-free, resulting in positive feedback on the migration experience, developer education, error understanding, library types, and TypeScript features.
  • Challenges included slow type checks and memory footprint issues, but Pinterest hopes for improvements with TypeScript's performance enhancements in the future.
  • Pinterest acknowledges the contributions and support from various teams and individuals during the migration process, aiming to provide valuable insights for others undertaking similar migrations.

Read Full Article

like

7 Likes

For uninterrupted reading, download the app