-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
types.ts
95 lines (88 loc) · 2.86 KB
/
types.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**
* Options that define the information necessary to find the api.json file
* and create individual page json files out of it
*/
export interface IPageJsonOptions {
/** Input files generated by api-extractor (one per package) */
apiJsonPaths: string[];
/** Output \*.page.json folder path. Page groups (if used) will go in subfolders. */
outputRoot: string;
/** If true, the generated files won't be pretty-formatted */
min?: boolean;
/**
* List of allowed page names (`@docCategory` tag values) grouped by any desired criteria,
* such as package name.
*/
pageGroups?: PageGroups;
/**
* Group for any page names (`@docCategory` tag values) not listed in `pageGroups`.
* If unspecified, unlisted pages will go under the root.
*/
fallbackGroup?: string;
}
/** Map from group name to page names */
export type PageGroups = { [groupName: string]: string[] };
/**
* Structure of the page.json files
*/
export interface IPageJson {
tables: ITableJson[];
name: string;
group?: string;
}
export type ApiKind = 'interface' | 'enum' | 'class' | 'typeAlias';
/**
* Info for a table representing a top-level API item: interface, enum, class, or type alias.
*/
export interface ITableJson {
kind: ApiKind;
name: string;
description?: string;
/**
* Any types the item extends, translated to an array of text elements and links to other types.
* For classes and interfaces only.
*
* Example: `Readonly<IFoo>` might translate to:
* `[{ text: 'Readonly<' }, { text: 'IFoo', linkedPage: 'Foo', linkedPageGroup: 'components' }, { text: '>' }]`
*/
extendsTokens?: ILinkToken[];
members?: ITableRowJson[] | IEnumTableRowJson[];
deprecated?: boolean;
deprecatedMessage?: string;
}
/**
* Generic row for API reference tables.
* It can represent a member (property or method) of an interface or class.
*/
export interface ITableRowJson {
name: string;
kind?: 'method' | 'property';
/**
* The row's type translated to an array of text elements and links to other types.
* For example, `Readonly<IFoo>` might translate to:
* `[{ text: 'Readonly<' }, { text: 'IFoo', linkedPage: 'Foo', linkedPageGroup: 'components' }, { text: '>' }]`
*/
typeTokens: ILinkToken[];
defaultValue?: string;
description?: string;
deprecated?: boolean;
deprecatedMessage?: string;
required?: boolean;
}
/**
* Enum member row for API reference tables.
*/
export type IEnumTableRowJson = Omit<ITableRowJson, 'kind' | 'typeTokens' | 'defaultValue' | 'required'> & {
value: string;
};
/**
* Text excerpt token that is part of a type definition or extends block and may have a link
* to another doc page.
*/
export interface ILinkToken {
text: string;
/** If this token is a link, name of the doc page it points to */
linkedPage?: string;
/** If this token is a link, group/category of the doc page it points to */
linkedPageGroup?: string;
}