JSDoc
ts-reset
JSDoc | ts-reset | |
---|---|---|
70 | 21 | |
14,832 | 7,642 | |
0.6% | 0.7% | |
9.3 | 3.3 | |
3 days ago | 11 days ago | |
JavaScript | TypeScript | |
Apache License 2.0 | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
JSDoc
-
Figma's Journey to TypeScript
You may like JSDoc[1] if you just want some type-safety from the IDE without the compilation overhead.
It’s done wonders when I’ve had to wrangle poorly commented legacy JavaScript codebases where most of the overhead is tracing what type the input parameters are.
Personally, I’m impartial to TypeScript or JSDoc at this point. But I’d rather have either over plain JavaScript.
[1] https://jsdoc.app/
-
Eloquent JavaScript 4th edition (2024)
I wholeheartedly agree. At most, I introduce JSDoc[1] to newer developers as standardising how parameters and whatnot are commented at least gets you better documentation and _some_ safety without adding any TS knowledge overhead.
[1] https://jsdoc.app/
-
Learn how to document JavaScript/TypeScript code using JSDoc & Typedoc
This is where JSDoc comes to save the day.
-
Add typing to your Javascript code (without Typescript, kinda) ✍🏼
The best way to do this, of course, is with JSDoc. But something I always found awkward about jsdoc is defining the object types in the same file. So, after a lot of reading, I found a way to combine JSDoc with declaration type files from Typescript. Let me give you an example:
-
What is JSDoc and why you may not need typescript for your next project?
There is a lot of specific symbols presented on the JSDOC specification that can be found here: https://jsdoc.app
-
TypeScript Might Not Be Your God: Case Study of Migration from TS to JSDoc
JSDoc is a specification for the comment format in JavaScript. This specification allows developers to describe the structure of their code, data types, function parameters, and much more using special comments. These comments can then be transformed into documentation using appropriate tools.
-
Adding a search feature to my app
Working with new features, frameworks, and tools, the experience of reading documentation is a critical part of it. I have been lucky to work with projects that feature really easy to read documentation such as USWDS and Bun, but I've also had the misfortune to work with pretty terrible documentation like JSDoc. The JSDoc documentation lacks a search field which makes searching for specific items an ordeal and also does not cover many hidden use cases. It provides less than the bare minimum for what it needs to do - a lot of the time I am forced to rely on external user documentation elsewhere to use JSDoc effectively. That was why I was drawn to the search field in particular in Docusaurus.
-
JavaScript First, Then TypeScript
The Svelte team followed suit but motivated by the maintainer's developer experience as they migrated the project away from TypeScript in favor of plain JSDoc comments for type annotations instead.
-
No comments. Now what?
Even more relevant, tools like Javadoc, JSDoc, Doxygen, etc. read comments in a specific format to generate documentation. These comments do not affect readability. On the contrary, Javadocs are great for explaining how to use these entities. Combined with tools like my dear Doctest, we even get guarantees of accuracy and correctness!
-
The Complete 2023 Guide to Learning TypeScript - From Beginner to Advanced
Document types with JSDoc annotations
ts-reset
-
Unleashing the Power of TypeScript: Improving Standard Library Types
TypeScript's standard library contains over 1,000 instances of the any type. There are many opportunities to improve the developer experience when working with strictly typed code. One solution to avoid having to fix the standard library yourself is to use the ts-reset library. It is easy to use and only needs to be imported once in your project.
-
Why doesn't TypeScript properly type Object.keys?
You might like TS Reset: https://github.com/total-typescript/ts-reset, which fixes this particular problem. I don't personally find it to be a big issue though.
Regarding runtime type checking, if you were to write something that can handle the total space of possible TS types, you would end up with incredibly complex machinery. It would be hard to make it perform, both in terms of speed and bundle size, and it would be hard to predict. I think Zod or perhaps https://arktype.io/ which target a reasonable subset are the only way to go.
-
Javascript vs typescript
https://github.com/total-typescript/ts-reset <-- this fixes the `(string | undefined)[]` issue and a few other quirks. Obviously it's annoying to need a library to fix quirks, but better than nothing.
-
Books/resources to improve TypeScript knowledge
Dude is an actual TypeScript wizard, his ts-reset package is a must have when dealing with JSON. He was featured in the VS Code day streams to show off some introductory TypeScript concepts and my big takeaway from that stream was this VS Code extension. Just stick // ^? on the line after something and it shows the type of the line above. Amazing with Prisma.
-
Typescript really hits the middle ground between extremely rigid statically typed languages on one extreme and no types at all dynamic languages on another extreme. Best type system
Personally I quite like ts-reset to "fix" some of the std lib types - JSON.parse will now return unknown. It's then up to you to decide how you wish to parse that unknown (zod, runtypes, io-ts are all reasonable options here). Won't ever be done by TS itself, as generating runtime code is a non-goal for the project.
-
Free Next.js Boilerplate for ⚡️High-Performance⚡️ Enterprise Apps
🛠️ Extremely strict TypeScript - With ts-reset library for ultimate type safety
-
How to construct this tuple type?
Ok, answered it myself: it was a perfect use case for ts-reset: https://github.com/total-typescript/ts-reset
- A 'CSS reset' for TypeScript, improving types for common JavaScript API's
What are some alternatives?
ESDoc - ESDoc - Good Documentation for JavaScript
zod - TypeScript-first schema validation with static type inference
documentation.js - :book: documentation for modern JavaScript
ts-async-kit - the easiest API to deal with promises in Typescript. Currently, ↩️ Retrying 🏃♂️ looping & 😴 sleeping
Docusaurus - Easy to maintain open source documentation websites.
garph - Fullstack GraphQL Framework for TypeScript
apiDoc - RESTful web API Documentation Generator.
Superforms - Superforms is a SvelteKit library that helps you with server-side validation and client-side display of forms.
YUIDoc - YUI Javascript Documentation Tool
sonner - An opinionated toast component for React.
storybook - Storybook is a frontend workshop for building UI components and pages in isolation. Made for UI development, testing, and documentation.
nuxt-scheduler - Create scheduled jobs with human readable time settings