Eleventy: Include TypeScript types for configuration files

Created on 18 Oct 2020  路  1Comment  路  Source: 11ty/eleventy

Is your feature request related to a problem? Please describe.
It's often unclear what configuration options are available, and it would be great to have documentation available on hover in my editor.

Describe the solution you'd like
By distributing TypeScript types, config files can use TypeScript's JSDoc checking to verify their configuration is set up properly.

/** @type {import('@11ty/eleventy').LocalConfig} */
const config = (eleventyConfig) => {
  // Add a filter using the Config API
  eleventyConfig.addFilter( "myFilter", function() {});

  // You can return your Config object (optional).
  return {
    dir: {
      input: "views"
    }
  };
};

module.exports = config

Describe alternatives you've considered
The types could alternatively be distributed by DefinetlyTyped instead. Consumers would install a @types package in addition to Eleventy.

Additional context
I have a type file already written! I'm happy to send a PR with tests if you're OK with this change.

enhancement

Most helpful comment

My PR https://github.com/11ty/eleventy/pull/720 is still awaiting going forward.

Related to #814

>All comments

My PR https://github.com/11ty/eleventy/pull/720 is still awaiting going forward.

Related to #814

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ndaidong picture ndaidong  路  4Comments

kaloja picture kaloja  路  3Comments

matt-auckland picture matt-auckland  路  3Comments

robdodson picture robdodson  路  3Comments

zellwk picture zellwk  路  3Comments