2022-04-13
2745
#gatsby#graphql#typescript
Yomi Eluwande
4770
Apr 13, 2022 ⋅ 9 min read

Setting up a TypeScript and Gatsby project with GraphQL

Yomi Eluwande JavaScript developer. Wannabe designer and Chief Procrastinator at Selar.co and worklogs.co.

Recent posts:

Exploring The Aha Stack: Astro, Htmx, Alpine — A Complete Tutorial With A Demo Project And Comparison To Other Stacks

Exploring the AHA stack: Tutorial, demo, and comparison

The AHA stack — Astro, htmx, and Alpine — is a solid web development stack for smaller apps that emphasize frontend speed and SEO.

Oyinkansola Awosan
May 3, 2024 ⋅ 13 min read
Comparing Hattip Vs Express Js For Modern Application Development

Comparing Hattip vs. Express.js for modern app development

Explore what Hattip is, how it works, its benefits and key features, and the differences between Hattip and Express.js.

Antonello Zanini
May 2, 2024 ⋅ 8 min read
Using React Shepherd To Build A Site Tour

Using React Shepherd to build a site tour

React Shepherd stands out as a site tour library due to its elegant UI and out-of-the-box, easy-to-use React Context implementation.

Onuorah Bonaventure
May 1, 2024 ⋅ 14 min read
A Guide To Cookies In Next Js

A guide to cookies in Next.js

Cookies are crucial to web development. This article will explore how to handle cookies in your Next.js applications.

Georgey V B
Apr 30, 2024 ⋅ 10 min read
View all posts

8 Replies to "Setting up a TypeScript and Gatsby project with GraphQL"

  1. Hi i am sorry if this a dumb question, but i am getting a cannot find ‘__PATH_PREFIX__’ in the layout.tsx. Is this something we are supposed to replace with a value, or does gatsby replace this value? When i clone the repo, this value doesnt seem to play well with typescript.

    1. I don’t believe that’s what Yomi is suggesting. You need to change the extension of blog-post.js to .tsx in line 7 of the gatsby-node.js file.

  2. Hey! Great article. Really easy to follow and understand. I managed to get setup and using TypeScript in a matter of minutes.

    Only problem I ran into was the `”type-check”: “tsc –noEmit”` was running checks on `node_modules` even although it was excluded! What fixed it for me was adding `”skipLibCheck”: true` to the `tsconfig.json` under `compilerOptions`.

    “`
    {
    “compilerOptions”: {
    “module”: “commonjs”,
    “target”: “esnext”,
    “jsx”: “preserve”,
    “lib”: [“dom”, “esnext”],
    “strict”: true,
    “noEmit”: true,
    “isolatedModules”: true,
    “esModuleInterop”: true,
    “noUnusedLocals”: false,
    “allowJs”: true,
    “skipLibCheck”: true //NEW
    },
    “exclude”: [“node_modules”, “public”, “.cache”]
    }
    “`

    Not sure if this will cause further issues down the line, but in the mean time I hope this helps anyone who runs into the same issue!

Leave a Reply