cem-plugin-jsdoc-function
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

cem-plugin-jsdoc-function

Allows JSDoc @function tag to override variable declarations

Example

custom-elements-manifest.config.js

import { jsdocFunctionPlugin } from 'cem-plugin-jsdoc-function';

export default {
  plugins: [
    jsdocFunctionPlugin(),
  ]
}

jsdoc-function.ts

/**
 * @function
 * @template T
 * @param {T} x
 * @return T
 */
export const identity = x => x;

Output

{
  "schemaVersion": "1.0.0",
  "readme": "",
  "modules": [
    {
      "kind": "javascript-module",
      "path": "jsdoc-function.js",
      "declarations": [
        {
          "kind": "function",
          "name": "identity",
          "parameters": [
            {
              "name": "x",
              "type": {
                "text": "T"
              }
            }
          ],
          "return": {
            "type": {
              "text": ""
            }
          }
        }
      ],
      "exports": [
        {
          "kind": "js",
          "name": "identity",
          "declaration": {
            "name": "identity",
            "module": "jsdoc-function.js"
          }
        }
      ]
    }
  ]
}

Package Sidebar

Install

npm i cem-plugin-jsdoc-function

Weekly Downloads

64

Version

0.0.5

License

MIT

Unpacked Size

2.65 kB

Total Files

4

Last publish

Collaborators

  • bennyp