This issue is about the TypeScript types shipped by Gatsby.
As shown here, a commit was made that made it into v2.3.35 that changed the GatsbyNode type's name to just Node. Although this was a breaking change for those depending on the types, I thought it would be a simple thing to update and get our codebase compiling again.
However, I was getting a strange error message when I updated the type (GatsbyNode) to the new name (Node):
Type '{ createPages: ((args: CreatePagesArgs & { traceId: "initial-createPages"; }, options?: PluginOptions | undefined, callback?: PluginCallback | undefined) => void) | undefined; }' is missing the following properties from type 'Node': id, parent, children, internal. ts(2739)
After looking further into the issue, I realised that Gatsby already exports a separate type called Node (that is related to this kind of node), which can be seen here. This is what was causing the above error message, as this Node type requires the id, parent, children and internal properties to be defined.
The likely reason this mistake was allowed to slip through is because of Declaration Merging in TypeScript.
To fix this issue, please revert this name change made to this type (Node -> GatsbyNode).
Tagging @wKovacs64 and @pieh as they were the ones that created and committed this change.
Yes, you are totally right, I'm not sure how I didn't spot it, I'll push fix shortly
@joealden can you take a look at https://github.com/gatsbyjs/gatsby/pull/13799 and let me know if this is what you meant?
@pieh yeah that is what I meant, looks good!
Wow, yeah that definitely should not have made it in. Can't believe we all missed it! :sweat_smile: Thanks for the quick fix, @pieh.
Published [email protected]