forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIDocElement.ts
More file actions
144 lines (127 loc) · 3.29 KB
/
IDocElement.ts
File metadata and controls
144 lines (127 loc) · 3.29 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/**
* The following interfaces represent Doc Elements of a
* documentation block.
*
* @remarks if adding a new 'kind', then it is essential that you update the
* methods within DocElementParser (getasText() and parse()).
*/
export interface IBaseDocElement {
kind: string;
}
/**
* Any natural language text in a doc comment.
*/
export interface ITextElement extends IBaseDocElement {
kind: 'textDocElement';
value: string;
}
/**
* A link that was specified as \{@link http://url | optional display text\}.
* The alternative to the IHrefLinkElement is ICodeLinkElement, where instead
* of a href the reference is to an API definition.
*
* Examples:
* \{@link http://microsoft.com | Microsoft \}
* \{@link http://microsoft.com \}
*/
export interface IHrefLinkElement extends IBaseDocElement {
/**
* Used to distinguish from an ICodeLinkElement.
*/
referenceType: 'href';
/**
* The url that this link element references.
*/
targetUrl: string;
/**
* Text to be shown in place of the full link text.
*/
value?: string;
}
/**
* A link that references an API definition as \{@link ApiReference | optional display text \}.
* The presentation of the reference link is left to the ts-spec tool.
*/
export interface ICodeLinkElement extends IBaseDocElement {
/**
* Used to distinguish from an IHrefLinkElement..
*/
referenceType: 'code';
/**
* Example: 'Guid'
*/
exportName: string;
/**
* Example: '@microsoft'
*/
scopeName?: string;
/**
* Example: 'sp-core-library'
*/
packageName?: string;
/**
* Example: 'newGuid'
*/
memberName?: string;
/**
* Optional text to display in place of the API reference string url that is
* constructed from the ts-spec tool.
*/
value?: string;
}
/**
* An element that denotes one of more elements to see for reference.
*
* Example:
* @see
* {@link http://microsoft.com | Microsoft}
* This is a description of the link.
* ->
* {
* kind: 'seeDocElement,
* seeElements: [
* {kind: 'linkDocElement', targetUrl: http://microsoft.com, value: Microsoft},
* {kind: 'textDocElement', value: 'This is a description of the link.'}
* ]
* }
*/
export interface ISeeDocElement extends IBaseDocElement {
kind: 'seeDocElement';
seeElements: IDocElement[];
}
export type ILinkDocElement = IHrefLinkElement | ICodeLinkElement;
export type IDocElement = ITextElement | ILinkDocElement | ISeeDocElement;
/**
* An element that represents a param and relevant information to its use.
*
* Example:
* @param1 httpClient - description of httpClient {@link http://website.com}
* ->
* {
* name: httpClient,
* description: [
* {kind: 'textDocElement', value: 'description of httpClient'},
* {kind: 'linkDocElement', targetUrl: 'http://website.com}
* ]
* }
*
*/
export interface IParam {
name: string;
description: IDocElement[];
isOptional?: boolean; // Used by ApiJsonGenerator
isSpread?: boolean; // Used by ApiJsonGenerator
type?: string; // Used by ApiJsonGenerator
}
/**
* Describes a return type and description of the return type
* that is given in documentation comments.
*/
export interface IReturn {
type: string;
description: IDocElement[];
}
export interface IDocElementCollection {
summaryTokens: IDocElement[];
remarksTokens: IDocElement[];
}