How to add Typescript to GatsbyJS
![Oscar de la Hera Gomez](https://www.delasign.com/CDN/headshots/profile.webp)
![A flower that symbolizes Typescript next to a flower that symbolizes GatsbyJS](https://www.delasign.com/CDN/images/How-to-add-Typescript-to-GatsbyJS.webp)
The following tutorial offers a step by step guide on how to add Typescript to GatsbyJS.
Download the open source starter project available on GitHub using the button below.
Step One: Create a Gatsby Starter Project
![A screenshot of terminal letting you know how to initialize a new gatsby starter project](https://www.delasign.com/CDN/images/Init-Gatsby.webp)
Run the following line in terminal and complete the quiz.
npm init gatsby
Step Two: Set the current directory to your project
![A screenshot of terminal showing you how to setup your current directory](https://www.delasign.com/CDN/images/Set-Current-Directory_2022-06-27-183800_oriq.webp)
Set the current directory to the name of your new project. In this case, the project was called my-gatsby-site.
cd my-gatsby-site
Step Three: Add Typescript
![A screenshot of terminal showing you how to add typescript to your existing gatsbyjs project.](https://www.delasign.com/CDN/images/Add-Typescript.webp)
In terminal, run the following line
yarn add typescript @types/node @types/react @types/react-dom @types/jest
Step Four: Add Gatsby's Typescript Plugin
![A screenshot of terminal showing you how to add the Typescript Plugin to your existing gatsbjs starter project.](https://www.delasign.com/CDN/images/add-typescript-plugin.webp)
In Terminal, run the following line
yarn add gatsby-plugin-typescript
Step Five: Create your tsconfig.json
![A screenshot of what the tsconfig.json looks like. Available in the gist below.](https://www.delasign.com/CDN/images/Tsconfig.webp)
In the root of your project, create a tsconfig.json and copy in the file below.
Step Six: Rename files
![A screenshot showing your javascript files renamed to typescript files.](https://www.delasign.com/CDN/images/Rename-Files.webp)
Rename all your desired Javascript files (.js) to Typescript (.tsx).
Looking to add support for Alias's or Paths?
Check out our step by step tutorial.
Any Questions
We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.