DEV Community

Discussion on: The power of jsDoc

Collapse
 
jorinvo profile image
jorin

I can see why people like TypeScript, but personally I don't like the overhead of working with it and rather write plain JS.
However, for expressing types and documentation I think TypeScript is a great tool.

I came up with the idea of using TypeScript typings solely for documentation, in a separate file like this. This gives you auto-completion and inline docs without disturbing the main coding workflow.
And you can use tools like typedoc to generate documentation.

Collapse
 
gmartigny profile image
Guillaume Martigny

I like this idea of a different file for the documentation, but is that not a pain in the a** to maintain ?

Collapse
 
jorinvo profile image
jorin

Not more than writing other kinds of external documentation.
I think it is a nice approach for packages with a small scope, but you are right, for internal-only code I would also prefer documentation inline with code since it is easier to think about updating it.