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.

Documentation: Consider generating website docs from JSDoc in .d.ts files

See original GitHub issue

Given prior decisions…

… I think there might be an easier option to maintain documentation, typings, and support i18n. The basic workflow would be:

  1. Put full documentation (not just default values) in the JSDoc in .d.ts files.
  2. Allow translators to use jsdoc-i18n to maintain text translations in a simple sqlite file.
  3. Generate documentation — and all translations — from the sqlite file.

One advantage of this is that the documentation and typings are in the same place. I suspect it will also make things much easier for translators, but — to be clear — I don’t know how robust json-i18n’s workflow is. You can find some discussion of this on https://github.com/jsdoc/jsdoc/issues/1127 and https://github.com/documentationjs/documentation/issues/899.

The other effect of this, which could be a downside depending on our preferences, is that it does require a build step for generating the documentation. It’s entirely possible to include headers and example code in JSDoc (example) but this may still limit the customization possible on individual docs pages.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
donmccurdycommented, Sep 10, 2020

I see, thanks. If JSDoc (or Documentation.js, or similar projects) ever make a really well-supported documentation+i18n workflow we may want to consider it — i don’t think mixing docs and typings would be inherently bad. But it’s not clear that the tools work well enough today to justify switching, especially if we have misgivings about it. I’ll close this suggestion!

1reaction
mrdoobcommented, Sep 10, 2020

And I worry that the cost of keeping docs up to date is going to increase as we support more languages, too.

I’ve been thinking about this. In the past we have updated the Chinese docs ourselves.

Now that we have Arabic and Korean, it’s clear to me that we should stop doing that and let the maintainers of the localized docs keep these up to date themselves.

Does #19919 mean that the JSDoc in d.ts files should have default values but no English descriptions of methods?

Yes. That was my understanding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSDoc Reference - TypeScript: Documentation
JSDoc Reference. The list below outlines which constructs are currently supported when using JSDoc annotations to provide type information in JavaScript files.
Read more >
Generate Typescript .d.ts file with original jsdoc comments?
After investigation, I see that the JSDOC is still present in the generated javascript, but it is not in the .d.ts file -...
Read more >
Confident JS series: Part 2 — Types, JSDocs, and ...
TS in JS files. The key here is JSDocs: JSDoc 3 is an API documentation generator for JavaScript, similar to Javadoc or phpDocumentor....
Read more >
Generating Documentation for TypeScript Projects
The screenshot above is of the generated documentation from a TypeScript project at Cloudflare. Why not JSDoc? JSDoc Example 1. The amount of ......
Read more >
Configuring JSDoc with a configuration file
How to configure JSDoc using a configuration file. ... on the command line, determines the set of input files that JSDoc uses to...
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