Typings via 11ty.ts
Is your feature request related to a problem? Please describe.
TypeScript support, more specifically declarations within .eleventy.js
configuration files seems to be a rather problematic for folks. The current approaches wherein using jsdoc annotations does not really suffice, nor does it solve plugin types. I've touched on this previously in issues, but I am yet to see any actionable steps in this area.
Describe the solution you'd like
I've gone ahead and exposed support for Eleventy in an isolated manner via 11ty.ts and this brings type support for the available API, with both JSDoc descriptions and linked documentation references available in declarations. In addition, plugins which expose types are also supported using an auto-typed tactic.
I believe this will assist developers in their usage with 11ty and solves all issues pertaining to type related support. Given that auto-typed plugins is made available, this also allows for great support in th eco. The implementation is quite simple, developers can just consume and expose using a defineConfig()
export.
For Example:
const { defineConfig } = require("11ty.ts");
module.exports = defineConfig (function(eleventyConfig) {
eleventyConfig.addPlugin()
return {};
})
Preview
https://github.com/11ty/eleventy/assets/7041324/569190b3-cd3a-4100-b4d4-fd7e0c910623
Describe alternatives you've considered
No response
Additional context
If the overall TypeScript discussions and issues around typings are not something planned or have been concluded upon, it would be nice that developers can more easily find this solution, from both a maintenance side and also availability side via the 11ty official documentation.
Lastly, the reason this is not made available to DefinitelyTyped is because their is JS required, given the defineConfig
export. It is not possible to bridge fluid support without applying a wrapper.