question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add capability of transforming and emitting JSDoc comments

See original GitHub issue

So I am trying to create a new documentation generator for TypeScript together with @BurtHarris. Currently it does not do much; I’ve been mainly tinkering a bit with the compiler API to see what it is capable of. You will be able to find it here when it’s finished.

One of the things we thought about was the ability to ‘target’ JSDoc comments using the type information provided by TypeScript. I’ve been investigating how to tackle the issue. Ideally, it would use the transformers the compiler API has to offer but of all the functions provided in factory.ts, the ones that came closest were addSyntheticLeadingComment, setSyntheticLeadingComments, setSyntheticTrailingComments and addSyntheticTrailingComment; none of which provide the means to create complete synthetic JSDoc tags and comments.

So with this issue I’m actually asking the status-quo of this feature. Is it still possible to get this on the roadmap? If so, can I help? If not, is there a possibility of a patch that makes it possible to implement this as a third-party module?

Related issues

Previous attempts

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:19
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
Jack-Workscommented, Nov 26, 2019

ts.createSynthesizedNode

Hmm sorry but it is no longer exists anymore. So how can I transform a JSDoc comment now?

2reactions
alanhoffcommented, Nov 6, 2020

it’s possible to emit jsdoc nodes using ts.factory.createJSDocComment, example:

https://gist.github.com/alanhoff/b1a2ed871cf7046ca1f2f3c9e0bae1aa

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started with JSDoc 3
A quick-start to documenting JavaScript with JSDoc. ... You add documentation comments directly to your source code, right alongside the code itself.
Read more >
JSDoc typings: all the benefits of TypeScript, with none of the ...
How you can use JSDoc typings to get all the benefits of TypeScript, without any transpilation.
Read more >
Compiling LibPDQ to JS with Emscripten Part 4: Writing Docs ...
I had heard you can generate types from JSDoc comment, so I decided to use JSDoc to document the functions. Changing export style....
Read more >
How to Write Doc Comments for the Javadoc Tool - Oracle
Our documentation comments define the official Java Platform API Specification. ... capabilities and both contribute to the best doc comments possible.
Read more >
How to Write a TypeScript Transform (Plugin) | by Kris Zyp
One of the exciting new features in TypeScript is the ability to write your own plugins, or “custom transformers”. This was added in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found