From d113419b254758bba273b4e06c678bbcca3f5167 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Mon, 28 Feb 2022 14:05:36 +0100 Subject: [PATCH 1/2] Update typescript.md --- docs/docs/how-to/custom-configuration/typescript.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/docs/how-to/custom-configuration/typescript.md b/docs/docs/how-to/custom-configuration/typescript.md index 0e584fc79d4e2..6ed1945e8e351 100644 --- a/docs/docs/how-to/custom-configuration/typescript.md +++ b/docs/docs/how-to/custom-configuration/typescript.md @@ -85,6 +85,8 @@ export const query = graphql` ### `gatsby-browser.tsx` / `gatsby-ssr.tsx` +> Support added in `gatsby@4.8.0` + You can also write `gatsby-browser` and `gatsby-ssr` in TypeScript. You have the types `GatsbyBrowser` and `GatsbySSR` available to type your API functions. Here are two examples: ```tsx:title=gatsby-browser.tsx @@ -155,6 +157,8 @@ const getServerData: GetServerData = async props => { ### `gatsby-config.ts` +> Support added in `gatsby@4.9.0` + You can import the type `GatsbyConfig` to type your config object. **Please note:** There are currently no type hints for `plugins` and you'll need to check the [current limitations](#current-limitations) and see if they apply to your `gatsby-config` file. ```ts:title=gatsby-config.ts @@ -172,6 +176,8 @@ export default config ### `gatsby-node.ts` +> Support added in `gatsby@4.9.0` + You can import the type `GatsbyNode` to type your APIs by accessing keys on `GatsbyNode`, e.g. `GatsbyNode["sourceNodes"]`. **Please note:** You'll need to check the [current limitations](#current-limitations) and see if they apply to your `gatsby-node` file. ```ts:title=gatsby-node.ts @@ -211,6 +217,8 @@ export const sourceNodes: GatsbyNode["sourceNodes"] = async ({ ### Local Plugins +> Support added in `gatsby@4.9.0` + All the files mentioned above can also be written and used inside a [local plugin](/docs/creating-a-local-plugin/). ## `tsconfig.json` From fe92fc002ffda770fee3f717c375419f01149bb4 Mon Sep 17 00:00:00 2001 From: Lennart Date: Mon, 28 Feb 2022 14:10:25 +0100 Subject: [PATCH 2/2] Update typescript.md --- docs/docs/how-to/custom-configuration/typescript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/how-to/custom-configuration/typescript.md b/docs/docs/how-to/custom-configuration/typescript.md index 6ed1945e8e351..bebdc34a43b1c 100644 --- a/docs/docs/how-to/custom-configuration/typescript.md +++ b/docs/docs/how-to/custom-configuration/typescript.md @@ -85,7 +85,7 @@ export const query = graphql` ### `gatsby-browser.tsx` / `gatsby-ssr.tsx` -> Support added in `gatsby@4.8.0` +> Support added in `gatsby@4.8.0` You can also write `gatsby-browser` and `gatsby-ssr` in TypeScript. You have the types `GatsbyBrowser` and `GatsbySSR` available to type your API functions. Here are two examples: