npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

easy-typescript-documentation

v1.0.3

Published

Create documentation from class

Downloads

28

Readme

Easy-typescript-documentation

Generate documentation based on your typescript classes.
I created this package because I had difficulties using tsdoc for my basic needs.

Check out typescirpt-rest if you want to generate documentation for your API.
If you need more functionnalities check out tsdoc.

The packages provides some pre-defined annotations, and functions to create your owns.

You can check the documentation (Generated with the getDocPage function).
If you don't like the look, feel free to create your own layout based on the json generated by the getJson functions.

Github Repository.

Support for methods is coming. (probably soon)

Quick Start

npm i --save typescript easy-typescript-documentation

Set "experimentalDecorators": true and "target": "ES2017" or above in tsconfig.json

model.ts

import {Doc, ClassName, ClassDesc, Name, Desc, Color, DOC_COLOR, Note} from "easy-typescript-documentation"

@Doc
@ClassName("My Object")
@ClassDesc("Object with a name, a setter and a getter.")
class myObject {

    constructor(name: string) {
        this.name = name;
    }

    @Name("Name")
    @Desc("This is a description")
    @Color(DOC_COLOR.ORANGE)
    @Note("This is a note")
    name: string;

}

doc.ts

import * as model from "./model"
import { getDocPage, getJson } from "easy-typescript-documentation"

//Returns a list of object representing each class with the @Doc decorator in model.ts
//You can use it to build your own UI. More infos in JSON structure
const json = getJson(model)

//Return an html page as a string that you can return from your api
const name = "My documentation"
const description = "Exemple documentation"
const htmlPage = getDocPage(name, model, description)

Here is the resulting htlm page with some more classes in model.ts

JSON structure

The function getJson returns a liste containing all classes in the object passed to it.
The objects follow this pattern.

{
    name: "name",       //If using @ClassName
    description: ""     //If using @ClassDesc
    //...Other custom class decorators

    //Annotated properties
    properties : [{
        key: "key",                     //key of the propertie
        type: "string"                  //Typescript type
        name: "name",                   //If using @Name
        description: "description",     //If using @Desc
        color: "red",                   //If using @Color
        note : "note"                   //If using @Note
        //...Other custom propertie decorators
    },
        //...Others properties
    ],

}

Create your own annotation

Note that getDocPage only work with the pre-defined annotations.
You will need to build your own html page base on the added annotations with getJson.

You can create your decorators for class and properties.
They will add the value(s) passed to them to the json generated by getJson under the key specified at their creation.
You create decorators with up to 3 parameters.

import { createPropertieAnnotation, createClassAnnotation } from "easy-typescript-documentation"

const my_class_annotation = createClassAnnotation<string>("myCustomKey")

const propertie_annotation = createPropertieAnnotation<number>("myCustomKey2")

const prop_annotation = createPropertieAnnotation<number,string>("number","string")

@Doc
@my_class_annotation("value")
class Exemple {

    @propertie_annotation(1)
    @prop_annotation(3,"value")
    id: number = 1
    
}

Here is the resulting json.

{
    myCustomKey: "value",
    properties : [
        {
            key: "id",
            type: "number",
            myCustomKey2: 1,
            number: 3,
            string: "value"
        }
    ]
}