Intellisense (typedefs) for your eleventy configuration file #2089
-
I just thought this would be useful for people. I'd love to see a short blog post on this, if someone has time. /**
* @typedef {import("@11ty/eleventy/src/UserConfig")} EleventyConfig
* @typedef {ReturnType<import("@11ty/eleventy/src/defaultConfig")>} EleventyReturnValue
*
* @type {(eleventyConfig: EleventyConfig) => EleventyReturnValue}
*/
module.exports = function(eleventyConfig) {
// write some code...
} Edit: Shorter version /**
* @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig
* @returns {ReturnType<import("@11ty/eleventy/src/defaultConfig")>}
*/
module.exports = function(eleventyConfig) {
// some code...
} |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
Is this right? |
Beta Was this translation helpful? Give feedback.
-
I think we should file this as an official documentation request in https://github.com/11ty/11ty-website. Not sure where the final docs would love (Getting Started? somewhere else?) but having code hinting documented would be a huge improvement to my workflows and help me from mistyping |
Beta Was this translation helpful? Give feedback.
-
just found this: #577 (comment) |
Beta Was this translation helpful? Give feedback.
-
For future folks this is on the docs here: https://www.11ty.dev/docs/config/#type-definitions |
Beta Was this translation helpful? Give feedback.
For future folks this is on the docs here: https://www.11ty.dev/docs/config/#type-definitions