Skip to content

Commit

Permalink
TypeStronggh-1556 make example tweaks as requested
Browse files Browse the repository at this point in the history
  • Loading branch information
srmagura committed Oct 3, 2021
1 parent 869e712 commit 544e224
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 133 deletions.
8 changes: 4 additions & 4 deletions example/README.md
Expand Up @@ -32,10 +32,10 @@ the package.**

Here are some examples we wanted to highlight:

### Playgrounds
### Rendering

- Markdown playground: [[`markdownPlayground`]]
- Syntax highlighting playground: [[`syntaxHighlightingPlayground`]]
- Markdown showcase: [[`markdownShowcase`]]
- Syntax highlighting showcase: [[`syntaxHighlightingShowcase`]]

### Functions

Expand All @@ -59,7 +59,7 @@ Here are some examples we wanted to highlight:

### Enums

- Basic enums: [[`IntegerEnum`]] and [[`StringEnum`]]
- A basic enum: [[`SimpleEnum`]]
- Using the `@enum` tag: [[`EnumLikeObject`]]

### Variables
Expand Down
1 change: 0 additions & 1 deletion example/includes/file.txt

This file was deleted.

83 changes: 3 additions & 80 deletions example/src/classes/CancellablePromise.ts
Expand Up @@ -33,6 +33,9 @@ function isPromiseWithCancel<T>(value: unknown): value is PromiseWithCancel<T> {
* - Complex method signatures
* - Static methods
* - A method with 10 overload signatures. Wow!
* - Only the implementation signature has a doc comment. TypeDoc
* automatically copies the comment from the implementation signature to
* each of the visible signatures if they don't have one.
*
* A promise with a `cancel` method. If canceled, the `CancellablePromise` will
* reject with a `Cancellation` object. Originally from
Expand Down Expand Up @@ -193,14 +196,6 @@ export class CancellablePromise<T> {
return new CancellablePromise(Promise.reject(reason), noop);
}

/**
* Analogous to `Promise.all`.
*
* @param values an array that may contain `CancellablePromise`s, promises,
* thenables, and resolved values
* @returns a [[`CancellablePromise`]], which, if canceled, will cancel each
* of the promises passed in to `CancellablePromise.all`.
*/
static all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
values: readonly [
T1 | PromiseLike<T1>,
Expand All @@ -216,14 +211,6 @@ export class CancellablePromise<T> {
]
): CancellablePromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;

/**
* Analogous to `Promise.all`.
*
* @param values an array that may contain `CancellablePromise`s, promises,
* thenables, and resolved values
* @returns a [[`CancellablePromise`]], which, if canceled, will cancel each
* of the promises passed in to `CancellablePromise.all`.
*/
static all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
values: readonly [
T1 | PromiseLike<T1>,
Expand All @@ -238,14 +225,6 @@ export class CancellablePromise<T> {
]
): CancellablePromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;

/**
* Analogous to `Promise.all`.
*
* @param values an array that may contain `CancellablePromise`s, promises,
* thenables, and resolved values
* @returns a [[`CancellablePromise`]], which, if canceled, will cancel each
* of the promises passed in to `CancellablePromise.all`.
*/
static all<T1, T2, T3, T4, T5, T6, T7, T8>(
values: readonly [
T1 | PromiseLike<T1>,
Expand All @@ -259,14 +238,6 @@ export class CancellablePromise<T> {
]
): CancellablePromise<[T1, T2, T3, T4, T5, T6, T7, T8]>;

/**
* Analogous to `Promise.all`.
*
* @param values an array that may contain `CancellablePromise`s, promises,
* thenables, and resolved values
* @returns a [[`CancellablePromise`]], which, if canceled, will cancel each
* of the promises passed in to `CancellablePromise.all`.
*/
static all<T1, T2, T3, T4, T5, T6, T7>(
values: readonly [
T1 | PromiseLike<T1>,
Expand All @@ -279,14 +250,6 @@ export class CancellablePromise<T> {
]
): CancellablePromise<[T1, T2, T3, T4, T5, T6, T7]>;

/**
* Analogous to `Promise.all`.
*
* @param values an array that may contain `CancellablePromise`s, promises,
* thenables, and resolved values
* @returns a [[`CancellablePromise`]], which, if canceled, will cancel each
* of the promises passed in to `CancellablePromise.all`.
*/
static all<T1, T2, T3, T4, T5, T6>(
values: readonly [
T1 | PromiseLike<T1>,
Expand All @@ -298,14 +261,6 @@ export class CancellablePromise<T> {
]
): CancellablePromise<[T1, T2, T3, T4, T5, T6]>;

/**
* Analogous to `Promise.all`.
*
* @param values an array that may contain `CancellablePromise`s, promises,
* thenables, and resolved values
* @returns a [[`CancellablePromise`]], which, if canceled, will cancel each
* of the promises passed in to `CancellablePromise.all`.
*/
static all<T1, T2, T3, T4, T5>(
values: readonly [
T1 | PromiseLike<T1>,
Expand All @@ -316,14 +271,6 @@ export class CancellablePromise<T> {
]
): CancellablePromise<[T1, T2, T3, T4, T5]>;

/**
* Analogous to `Promise.all`.
*
* @param values an array that may contain `CancellablePromise`s, promises,
* thenables, and resolved values
* @returns a [[`CancellablePromise`]], which, if canceled, will cancel each
* of the promises passed in to `CancellablePromise.all`.
*/
static all<T1, T2, T3, T4>(
values: readonly [
T1 | PromiseLike<T1>,
Expand All @@ -333,14 +280,6 @@ export class CancellablePromise<T> {
]
): CancellablePromise<[T1, T2, T3, T4]>;

/**
* Analogous to `Promise.all`.
*
* @param values an array that may contain `CancellablePromise`s, promises,
* thenables, and resolved values
* @returns a [[`CancellablePromise`]], which, if canceled, will cancel each
* of the promises passed in to `CancellablePromise.all`.
*/
static all<T1, T2, T3>(
values: readonly [
T1 | PromiseLike<T1>,
Expand All @@ -349,26 +288,10 @@ export class CancellablePromise<T> {
]
): CancellablePromise<[T1, T2, T3]>;

/**
* Analogous to `Promise.all`.
*
* @param values an array that may contain `CancellablePromise`s, promises,
* thenables, and resolved values
* @returns a [[`CancellablePromise`]], which, if canceled, will cancel each
* of the promises passed in to `CancellablePromise.all`.
*/
static all<T1, T2>(
values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]
): CancellablePromise<[T1, T2]>;

/**
* Analogous to `Promise.all`.
*
* @param values an array that may contain `CancellablePromise`s, promises,
* thenables, and resolved values
* @returns a [[`CancellablePromise`]], which, if canceled, will cancel each
* of the promises passed in to `CancellablePromise.all`.
*/
static all<T>(
values: readonly (T | PromiseLike<T>)[]
): CancellablePromise<T[]>;
Expand Down
37 changes: 11 additions & 26 deletions example/src/enums.ts
@@ -1,37 +1,22 @@
/** An integer enum. */
export enum IntegerEnum {
/** Describes the status of a delivery order. */
export enum SimpleEnum {
/** This order has just been placed and is yet to be processed. */
Pending,

/** Indicates that a courier is en route delivering this order. */
InProgress,

Complete,
}

/** A string enum. */
export enum StringEnum {
Pending = "pending",

/** Indicates that a courier is en route delivering this order. */
InProgress = "inProgress",

Complete = "complete",
}

/** A [const enum](https://www.typescriptlang.org/docs/handbook/enums.html#const-enums). */
export const enum ConstEnum {
Pending,

/** Indicates that a courier is en route delivering this order. */
/** A courier is en route delivering this order. */
InProgress,

Complete,
/** The order has been delivered. */
Complete = "COMPLETE",
}

/**
* [A crazy enum from the TypeScript
* handbook](https://www.typescriptlang.org/docs/handbook/enums.html#computed-and-constant-members).
* This enum contains both constant and computed members.
*
* TypeDoc won't show the value of computed members since this information is
* only available at runtime.
*/
export enum CrazyEnum {
// constant members
Expand All @@ -44,8 +29,6 @@ export enum CrazyEnum {
}

/**
* @enum
*
* Since TypeScript's `enum` can be inconvenient to work with, some packages define their own enum-like objects:
*
* ```
Expand All @@ -57,6 +40,8 @@ export enum CrazyEnum {
* ```
*
* Use the `@enum` tag to make TypeDoc document this object as an enum.
*
* @enum
*/
export const EnumLikeObject = {
Pending: "pending",
Expand Down
8 changes: 0 additions & 8 deletions example/src/functions.ts
@@ -1,11 +1,3 @@
/**
* @module
* This module demonstrates TypeDoc's support for functions.
*
* Use the [`@module`](https://typedoc.org/guides/doccomments/#%40module) tag to
* tell TypeDoc that a comment block describes the entire module.
*/

/**
* Calculates the square root of a number.
*
Expand Down
2 changes: 1 addition & 1 deletion example/src/index.ts
Expand Up @@ -4,6 +4,6 @@ export * from "./types";
export * from "./classes";
export * from "./enums";
export * from "./reexports";
export * from "./playground";
export * from "./showcase";
export * from "./reactComponents";
export * from "./internals";
16 changes: 5 additions & 11 deletions example/src/playground.ts → example/src/showcase.ts
@@ -1,5 +1,5 @@
/**
* # Markdown Playground
* # Markdown Showcase
*
* All comments are parsed as **Markdown**. TypeDoc uses the
* [Marked](https://github.com/markedjs/marked) markdown parser to _convert
Expand All @@ -23,7 +23,7 @@
* const x: number | string = 12
* ```
*
* See [[`syntaxHighlightingPlayground`]] for more code blocks.
* See [[`syntaxHighlightingShowcase`]] for more code blocks.
*
* ## A List
*
Expand Down Expand Up @@ -52,15 +52,8 @@
*
* This requires the [media option](https://typedoc.org/guides/options/#media)
* to be set.
*
* ## An External Text Document
*
* [[include:file.txt]]
*
* This requires the [includes
* option](https://typedoc.org/guides/options/#includes) to be set.
*/
export function markdownPlayground(): void {
export function markdownShowcase(): void {
// does nothing
}

Expand Down Expand Up @@ -119,7 +112,8 @@ export function markdownPlayground(): void {
*
* [**View the full list of supported
* languages.**](https://github.com/shikijs/shiki/blob/main/docs/languages.md#all-languages)
* You can also get this list by running `typedoc --help`.
*/
export function syntaxHighlightingPlayground(): void {
export function syntaxHighlightingShowcase(): void {
// does nothing
}
3 changes: 1 addition & 2 deletions example/typedoc.json
@@ -1,5 +1,4 @@
{
"sort": "source-order",
"media": "media",
"includes": "includes"
"media": "media"
}

0 comments on commit 544e224

Please sign in to comment.