Skip to content

Instantly share code, notes, and snippets.

@malkab
Created February 28, 2022 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malkab/dfadf3253d0f513b7b67ece80a5508df to your computer and use it in GitHub Desktop.
Save malkab/dfadf3253d0f513b7b67ece80a5508df to your computer and use it in GitHub Desktop.
TypeDoc TypeScript documentation
/**
A module documentation.
*/
export module BModule {
/**
A constant documentation.
*/
export const ACONST: number = 9;
/**
Interface documentation.
*/
export interface IInterface {
/** a interface member. */
a: string;
/** b interface member. */
b: number;
}
/**
A generic function documentation.
@typeParam T
Generic type documentation.
@param aParameter
aParameter parameter documentation.
@param __namedParameters
General options documentation.
@param __namedParameters.circleColor
Option circleColor documentation.
@param __namedParameters.circleStrokeColor
Option circleStrokeColor documentation.
@param __namedParameters.circleStrokeWidth
Option circleStrokeWidth documentation.
@param __namedParameters.circleRadius
Option circleRadius documentation.
@returns
Returns docs.
*/
export function a<T>(aParameter: number, {
circleColor = "#eeeeee",
circleStrokeColor = "#000000",
circleStrokeWidth = 1,
circleRadius = 3,
aFunction = (a: number) => a
}: {
circleColor?: string,
circleStrokeColor?: string,
circleStrokeWidth?: number,
circleRadius?: number,
/**
Option aFunction docs. This is the only way a function that is a
parameter can be properly documented. It's a little bit disruptive but
no other way AFAIK.
@param a
Parameter a of aFunction member function.
@returns
Returns of aFunction member function.
*/
aFunction: (a: number) => number
} = {
circleColor: "#eeeeee",
circleStrokeColor: "#000000",
circleStrokeWidth: 1,
circleRadius: 3,
aFunction: (a: number) => a
}): any {
// Implementation here
}
/**
Enumeration documentation.
*/
export enum EENUMERATION {
/** ITEMA documentation. */
ITEMA,
/** ITEMB documentation. */
ITEMB
}
/**
Dummy class.
*/
class ParentClass {
/**
fromParent member.
*/
public fromParent() {}
}
/**
Class documentation.
@typeParam T
Generic type documentation.
*/
export class TheClass<T> extends ParentClass implements IInterface {
/**
a member.
*/
public a: string = "";
/**
b member.
*/
public b: number = 0;
}
// This closes the module
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment