toggling between `JSDoc` and `TypeScript` examples in docs
See original GitHub issueDescribe 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:
- Created a year ago
- Reactions:18
- Comments:10 (9 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Definitely a good first step, but I can imagine a proper TypeScript example would improve the developer experience.
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!