Luke Murray

JSDoc typechecking

December 08, 2020

Today I learned javascript typechecking is way more advanced than I expected, even allowing for imports.

I’m using jsdoc typechecking in my gatsby-node.js files to get autocomplete and type safety on the APIs without the overhead of using a soon to be deprecated typescript config plugins and potentially complicating my project maintenance down the line.

/**
 * @typedef { import("gatsby").GatsbyNode} GatsbyNode
 */

/**
 * @type {GatsbyNode["createPages"]}
 */
exports.createPages = async ({ graphql, actions, reporter }) => {

 //...
}