|
| 1 | +# The TypeDoc Example |
| 2 | + |
| 3 | +Welcome to the TypeDoc example! TypeDoc is a documentation generator for |
| 4 | +TypeScript. |
| 5 | + |
| 6 | +TypeDoc automatically documents every variable, function, and class |
| 7 | +that is exported by your project. You can add explanations and examples to your |
| 8 | +documentation site by annotating your code with doc comments, e.g. |
| 9 | + |
| 10 | +``` |
| 11 | +/** |
| 12 | + * Calculates the square root of a number. |
| 13 | + * |
| 14 | + * @param x the number to calculate the root of. |
| 15 | + * @returns the square root if `x` is non-negative or `NaN` if `x` is negative. |
| 16 | + */ |
| 17 | +export function sqrt(x: number): number { |
| 18 | + return Math.sqrt(x); |
| 19 | +} |
| 20 | +``` |
| 21 | + |
| 22 | +This project shows off some of TypeDoc's features: |
| 23 | + |
| 24 | +- Built-in support for various TypeScript language constructs |
| 25 | +- Markdown in doc comments |
| 26 | +- Syntax highligting in code blocks |
| 27 | + |
| 28 | +## Index of Examples |
| 29 | + |
| 30 | +**Click the "Exports" link in the sidebar to see a complete list of everything in |
| 31 | +the package.** |
| 32 | + |
| 33 | +Here are some examples we wanted to highlight: |
| 34 | + |
| 35 | +### Rendering |
| 36 | + |
| 37 | +- Markdown showcase: [[`markdownShowcase`]] |
| 38 | +- Syntax highlighting showcase: [[`syntaxHighlightingShowcase`]] |
| 39 | + |
| 40 | +### Functions |
| 41 | + |
| 42 | +- Simple functions: [[`sqrt`]] and [[`sqrtArrowFunction`]] |
| 43 | +- A generic function: [[`concat`]] |
| 44 | +- Functions that take an options object: [[`makeHttpCallA`]] and [[`makeHttpCallB`]] |
| 45 | +- An overloaded function: [[`overloadedFunction`]] |
| 46 | +- An external function exported under a different name: [[`lodashSortBy`]] |
| 47 | + |
| 48 | +### Types |
| 49 | + |
| 50 | +- Type aliases: [[`SimpleTypeAlias`]] and [[`ComplexGenericTypeAlias`]] |
| 51 | +- Interfaces: [[`User`]] and [[`AdminUser`]] |
| 52 | + |
| 53 | +### Classes |
| 54 | + |
| 55 | +- A basic class: [[`Customer`]] |
| 56 | +- A subclass: [[`DeliveryCustomer`]] |
| 57 | +- A complex class: [[`CancellablePromise`]] |
| 58 | +- A class that extends a built-in generic type: [[`StringArray`]] |
| 59 | + |
| 60 | +### Enums |
| 61 | + |
| 62 | +- A basic enum: [[`SimpleEnum`]] |
| 63 | +- Using the `@enum` tag: [[`EnumLikeObject`]] |
| 64 | + |
| 65 | +### Variables |
| 66 | + |
| 67 | +- [[`PI`]], [[`STRING_CONSTANT`]], and [[`ObjectConstant`]] |
| 68 | + |
| 69 | +### React Components |
| 70 | + |
| 71 | +- Basic React components: [[`CardA`]] and [[`CardB`]] |
| 72 | +- A complex React component: [[`EasyFormDialog`]] and [[`EasyFormDialogProps`]] |
0 commit comments