Use jsdoc for js with stream type annotations

When trying to process js sources with stream type annotations, the jsdoc parser does not understand the extended syntax! Is there a way to use jsdoc in js sources that have been extended with stream annotations, or what is the recommended way to generate documentation from annotated js type?

+4
source share
2 answers

You can use babel with strip-flow-types type conversion and use this jsdoc plugin .

First you need to install babel and related packages and jsdoc-babel on top of jsdoc. Then create a jsdoc-conf.json file in the root directory containing something like the following:

{
    "plugins": ["node_modules/jsdoc-babel"],
    "babel": {
        "presets": ["react"],
        "plugins": ["transform-react-jsx", "transform-flow-strip-types"]
    }
}

You can use any valid Babel setting with jsdoc-babel, for example. presets for ES2015 or other plugins for babel. Hope this helps!

+3
source

Just started using documentation.js . Supports JSdoc and stream out of the box.

+4
source

Source: https://habr.com/ru/post/1652573/


All Articles