jsdoc-typescript-docs
Documents TypeScript code with JSDoc comments, generates API documentation, and creates type-safe documentation. Use when users request "JSDoc", "code documentation", "API docs", "TypeDoc", or "inline documentation".
By patricio0312rev · 510 installs
npx skills add patricio0312rev/skills --skill jsdoc-typescript-docs
Source repository · Upstream listing
JSDoc TypeScript Documentation
Create comprehensive inline documentation for TypeScript codebases.
Core Workflow
1. Document functions : Parameters, returns, examples
2. Document types : Interfaces, types, enums
3. Add descriptions : Purpose and usage
4. Include examples : Code samples
5. Generate docs : TypeDoc output
6. Integrate CI : Automated doc generation
Function Documentation
Basic Function
typescript
const total = calculateTotal(100, 0.08);
console.log(total); // 108
Async Function
typescript
try {
const user = await fetchUser('user 123');
console.log(user.name);
} catch (error) {
if (error instanceof NotFoundError) {
console.log('User not found');
}
}
Generic Function
typescript
const numbers = [1, 2, 3, 4, 5];
const evens = filterArray(numbers, n = n % 2 === 0);
// evens: [2, 4]
Overloaded Function
Interface Documentation
typescript
const user: User = {
id: 'user 123',
email: 'john@example.com',
name: 'John Doe',
role: 'admin',
createdAt: new Date(),
};
Type Documentation
typescript
function divide(a: number, b: number): Result<number, string {
if (b === 0) {
return { success: false, error: 'Division by zero' };
}
return { success: true, data: a / b };
}
Class Documentation
typescript
const client = ApiClient.create({
baseUrl: 'https://api.example.com',
apiKey: process.env.API KEY,
});
const users = await client.get<User[] ('/users');
typescript
const client = ApiClient.create({ baseUrl: 'https://api.example.com' });
typescript
interface User { id: string; name: string; }
const users = await client.get<User[] ('/users');
Enum Documentation
React Component Documentation
tsx
// Basic usage
<Button onClick={handleClick} Click me</Button
// With variant and size
<Button variant="secondary" size="lg"
Large Secondary Button
</Button
// Loading state
<Button loading Submitting...</Button
TypeDoc Configuration
JSDoc Tags Reference
typescript
// Example code
Best Practices
1. Document public API : All exports need docs
2. Use examples : Show real usage
3. Describe parameters : Clear, concise descriptions
4. Document errors : What can be thrown
5. Link related items : Use @see tags
6. Keep updated : Sync docs with code
7. Generate HTML : TypeDoc for browsable docs
8. Validate in CI : Check for missing docs
Output Checklist
Every documented codebase should include:
[ ] All public functions documented
[ ] All interfaces and types documented
[ ] All parameters described
[ ] Return values documented
[ ] Examples for complex functions
[ ] Thrown errors documented
[ ] TypeDoc configuration
[ ] Generated documentation
[ ] Documentation in CI pipeline
[ ] README with API overview