forked from TypeStrong/typedoc
/
enums.ts
77 lines (68 loc) · 1.85 KB
/
enums.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/** Describes the status of a delivery order. */
export enum SimpleEnum {
/** This order has just been placed and is yet to be processed. */
Pending,
/** A courier is en route delivering this order. */
InProgress,
/** 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
None,
Read = 1 << 1,
Write = 1 << 2,
ReadWrite = Read | Write,
// computed member
ComputedMember = "123".length,
}
/**
* Since TypeScript's `enum` can be inconvenient to work with, some packages define their own enum-like objects:
*
* ```
* export const EnumLikeObject = {
* Pending: 'pending',
* InProgress: 'inProgress',
* Completed: 'completed'
* } as const
* ```
*
* Use the `@enum` tag to make TypeDoc document this object as an enum.
*
* @enum
*/
export const EnumLikeObject = {
Pending: "pending",
/** Indicates that a courier is en route delivering this order. */
InProgress: "inProgress",
Completed: "completed",
} as const;
/**
* Since TypeScript's `enum` can be inconvenient to work with, some packages define their own enum-like objects:
*
* ```
* export const EnumLikeObjectNumValues = {
* Pending: 1,
* InProgress: 2,
* Completed: 3
* } as const
* ```
*
* Use the `@enum` tag to make TypeDoc document this object as an enum.
*
* @enum
*/
export const EnumLikeObjectNumValues = {
Pending: 1,
/** Indicates that a courier is en route delivering this order. */
InProgress: 2,
Completed: 3,
} as const;