🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Advice on Migrating a Gatsby Site to Typescript

6 replies
Last updated: May 12, 2021
Hey there, I was wondering if anyone has any experience, or advice on incrementally migrating a Gatsby site to Typescript? I’ve done a few searches, and not had a lot of luck. There’s lots on how to start a Gatsby site using TS, but I couldn’t find anything on actually migrating, least of all piece by piece.
May 12, 2021, 5:42 PM
nothing is stopping you from having JSX and TSX files
May 12, 2021, 5:42 PM
you can migrate components one at a time
May 12, 2021, 5:42 PM
for components that are really not
ts fun
i leave them js/jsx
May 12, 2021, 5:43 PM
Perfect! I’ve been a bit worried that it wouldn’t compile correctly, or that there’d be a bunch of build errors - but I’d really like to make the migration happen. So I plan to build my new features in TS, and the update the existing components as time allows.
May 12, 2021, 5:44 PM
yeah should support it so long as you have the ts package or on the gatsby that supports ts out of the box
May 12, 2021, 5:45 PM
Awesome! Thanks, Kev! And while I’m at it, thanks for all of the work that you do around here. I have been following your work for awhile, and it has been really helpful. Particularly the headless Shopify stuff. 🤘
May 12, 2021, 5:48 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?