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.

toggling between `JSDoc` and `TypeScript` examples in docs

See original GitHub issue

Describe the problem

As someone who prefers to write TypeScript code, having all examples on the docs page annotated with JSDoc makes e.g copy & pasting annoying because I have to convert it manually to TypeScript syntax. For me, a person that knows both syntaxes well, this might be a small problem.

But I already saw a few people struggle because they were new to JSDoc comments and didn’t know how the equivalent should look in TypeScript code. Having a proper TypeScript example would help them a lot.

Describe the proposed solution

A toggle could be provided somewhere on the docs page that allows to globally choose between JSDoc and TypeScript

Similar to the Vue.js documentation that allows to toggle between API styles.

Alternatives considered

JSDoc only examples

Importance

nice to have

Additional Information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:18
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
ivanhofercommented, Mar 27, 2022

Definitely a good first step, but I can imagine a proper TypeScript example would improve the developer experience.

2reactions
danielniccolicommented, Aug 16, 2022

For me, a person that knows both syntaxes well, this might be a small problem.

To give some input from a beginner in TypeScript and SvelteKit: It is immensely difficult to both, learn TypeScript and SvelteKit, when also having to translate the examples from JavaScript and JSDoc (which is something I haven’t heard before). Having all examples in the SK docs available in TypeScript would be immensely helpful!

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript + JSDoc = better-docs - Wojciech Krysiak - Medium
Convert TypeScript interfaces to “@interface” tags​​ All your documented interface definitions from TypeScript are converted to “@interface” — its JSDoc ...
Read more >
JSDoc Reference - TypeScript: Documentation
The list below outlines which constructs are currently supported when using JSDoc annotations to provide type information in JavaScript files.
Read more >
TypeScript vs. JSDoc JavaScript for static type checking
There's a debate to be had about whether using JavaScript or TypeScript leads to better outcomes when building a project.
Read more >
JSDoc comments | WebStorm Documentation - JetBrains
in the gutter, or select Toggle Rendered View from the context menu of a JSDoc comment, or press Ctrl+Alt+Q . Turn the Rendered...
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 >

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