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

@irwinproject/storybook-addon-tsdoc

v1.0.6

Published

Generate mdx documentation from your typescript!

Readme

storybook-addon-tsdoc

This addon is an attempt to add some additional documentation generation for non component based typescript.

Getting started

  1. Install the addon
npm install @irwinproject/storybook-addon-tsdoc
  1. Add the addon to .storybook/main.ts

const config: StorybookConfig = {
  //..
  addons: [
    //...
    "@irwinproject/storybook-addon-tsdoc"
  ],
};

Thats it... By default the addon makes a few assumptions.

  1. the /.storybook directory is located in the root directory of the project

  2. the tsconfig.json for the project is in the same directory as /.storybook.

    The addon uses your tsconfig primarily to resolve any custom path aliases. TS-Morph also uses the config replicate settings during compilation.

  3. The code to be documented is located in the /src folder

  4. Only files ending in .ts should be documented.

Configuring

you can configure the addon to work with most projects.

const config: StorybookConfig = {
  //..
  addons: [
    //...
    {
		name:"@irwinproject/storybook-addon-tsdoc",
		options: {
			//Relative use cwd to resolve.
			tsconfig: "tsconfig.json", 
			docs: ".tsdoc",
			tsconfig: "tsconfig",
			/*
			entry supports glob patterns 
			*/
			entry: "src/**/!(*.test|*.stories|*.d).ts",
			/*By default the docs directory specified above will be deleted and rebuilt. 
			However if you have other files not generated by this addon in said folder you can disable this feature by setting this value to false.
			*/
			shouldClearDocsOnStart: true,

			//Colors

			/*
			Each documented entity has a type representation provided (var, let, const, function, method, class, property, ...)
			This value lets you set this color
			*/
			kindColor: "#F08",

			/*
				The color used to represent native types.
			*/
			typeColor: "rgb(28,128,248)",

			/*
			the color for types that reference to an internal non native type. 
			*/
			refColor: "rgb(0,100,220)",

			/*
			the color used to represent literal types.
			*/
			litColor: "rgb(248, 28, 28)",

			/*
			the color used for named components like arguments or properties.
			*/
			nameColor: "rgb(248, 128, 28)"
		}
	}
  ],
};

Limitations

  1. Currently storybook-addon-tsdoc only supports a single entry point.

    • I am exploring methods to build documentation and prevent name collisions for now a glob pattern can be used to encapsulate multiple entry points if necessary.
  2. /src file is aliased to '' when building documentation structure.

    • I am exploring adding an alias system similar to path aliases to allow for the documentation paths to better reflect the production file structure rather then the development structure.
  3. Documentation is generated per file.

    • I am exploring more of a per declaration structure similar to how JSDocs works however a concession was made to reach my goal. maybe next release I will add this.
  4. No HMR support.

    • Updating existing files does not appear to be problematic however I have been unable to find a way to register new files with storybooks mdx parser.
    • While looking into this issue I found that Storybooks docs addon uses virtual files while in dev mode. I would like to research this further to see if I could take advantage of the same behaviors.
  5. Lacks tag support.

    • It occured to me toward the end of the production process that it might be more beneficial to find files based on tags in a .stories.tsx file in some situations. While I am not sure I will be building out support for this behavior it is something I am considering.
  6. Shallow type parsing

    •   const SOMEVALUE: number = 10; //number
        const SOMEVALUE = 10; //evaluates to the type literal 10.
        const SOMEVALUE = "1".charCodeAt(0); //number
        const CIRCLE = Math.PI * 2; // PI*2
    • This becomes more evident when documenting functions as return types are not provided as a CallExpression when no return type is specified
    	function distance(x1: number, y1: number, x2: number, y2: number){
    		return //find distance
    	}
    
    	/*
    	evaluates as 
    	(x1: number, y1: number, x2: number, y2: number) => void
    	*/
    
    	function distance(x1: number, y1: number, x2: number, y2: number): number{
    		return //find distance
    	}
    	/*
    	evaluates as 
    	(x1: number, y1: number, x2: number, y2: number) => number
    	*/

    I do plan on addressing this as I build a type infer method.

    Feature Requests.

    While I tried to test a range of use cases There may be patterns which are not properly handled or represented. If you find any such instances please submit an issue with the following information.

    1. an example of the code that is being parsed incorrectly.
    2. an explanation of how it should be represented or how its being represented incorrectly. (I cannot promise I will represent a pattern or declaration in your preferred manner however I will try to use existing accepted representations.)
    3. the version of the addon you are utilizing.

    I welcome requests for additional features and as I have time to update the addon I will.