Home / Companies / Sanity / Blog / Post Details
Content Deep Dive

Migrating the Sanity.io codebase from Flow to TypeScript

Blog post from Sanity

Post Details
Company
Date Published
Author
Bjørge Næss
Word Count
1,902
Language
English
Hacker News Points
-
Summary

Sanity.io recently transitioned its codebase from Flow to TypeScript, addressing challenges in modernizing their build pipeline and managing CSS modules, while ensuring backward compatibility. This change aims to enhance code robustness through static typing, enabling developers to catch errors early and improve maintainability. Initially, the migration involved using Babel for compiling all source code and the TypeScript compiler for emitting type declarations, revealing more type errors compared to Flow. Although the current focus is on improving the TypeScript pipeline and removing Flow, the long-term goal is to provide comprehensive TypeScript definitions for all packages, facilitating faster and more reliable code development. This transition lays a foundation for gradually improving type systems, which is expected to benefit Sanity.io's developers and users by reducing errors, accelerating development, and enhancing the accessibility of the codebase, while ensuring that TypeScript remains optional for developers.