-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathDeclaration.ts
More file actions
246 lines (230 loc) · 6.05 KB
/
Declaration.ts
File metadata and controls
246 lines (230 loc) · 6.05 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
import { Node } from '../Node';
import { AccessorDeclaration } from './AccessorDeclaration';
import { ClassDeclaration } from './ClassDeclaration';
import { DeclarationVisibility } from './DeclarationVisibility';
import { InterfaceDeclaration } from './InterfaceDeclaration';
import { MethodDeclaration } from './MethodDeclaration';
import { ParameterDeclaration } from './ParameterDeclaration';
import { PropertyDeclaration } from './PropertyDeclaration';
import { VariableDeclaration } from './VariableDeclaration';
/**
* Basic interface for all declarations. Defines the basic needed information for a typescript declaration.
*
* @export
* @interface Declaration
* @extends {Node}
*/
export interface Declaration extends Node {
/**
* The name of the declaration.
*
* @type {string}
* @memberof Declaration
*/
name: string;
}
/**
* Interface for all typed declarations. Those declarations contain a type that must be taken care of.
* (e.g. 'string' or 'number')
*
* @export
* @interface TypedDeclaration
* @extends {Declaration}
*/
export interface TypedDeclaration extends Declaration {
/**
* The type of the declaration.
*
* @type {(string | undefined)}
* @example "string"
* @example "Declaration[]"
* @memberof TypedDeclaration
*/
type: string | undefined;
}
/**
* Interface for generic type declarations. Those declarations are able to be used in a generic way.
* Examples are: classes, interfaces, methods and such.
*
* @export
* @interface GenericDeclaration
* @extends {Declaration}
*/
export interface GenericDeclaration extends Declaration {
/**
* List of type parameters
*
* @type {(string[] | undefined)}
* @memberof GenericDeclaration
*
* @example
* ['T', 'TResult', 'TError']
*/
typeParameters: string[] | undefined;
}
/**
* Interface for exportable declarations. Does contain information about the export status of a declaration.
*
* @export
* @interface ExportableDeclaration
* @extends {Declaration}
*/
export interface ExportableDeclaration extends Declaration {
/**
* Indicates if the declaration is exported (i.e. export function ...) or not.
*
* @type {boolean}
* @memberof ExportableDeclaration
*/
isExported: boolean;
}
/**
* Interface for visible declarations. Does contain information about the visibility of the declaration.
*
* @export
* @interface ScopedDeclaration
* @extends {Declaration}
*/
export interface ScopedDeclaration extends Declaration {
/**
* Defines the visibility scope of the declaration. Can be undefined, in which case there
* is no visibility given (e.g. methods in interfaces).
*
* @type {(DeclarationVisibility | undefined)}
* @memberof ScopedDeclaration
*/
visibility: DeclarationVisibility | undefined;
}
/**
* Interface for class like constructs. Contain properties and methods that are contained.
* Examples are classes, interfaces, abstract classes, etc.
*
* @export
* @interface ClassLikeDeclaration
* @extends {Declaration}
*/
export interface ClassLikeDeclaration extends Declaration {
/**
* Accessors of this class.
*
* @type {AccessorDeclaration[]}
* @memberof ClassLikeDeclaration
*/
accessors: AccessorDeclaration[];
/**
* The properties of the declaration.
*
* @type {PropertyDeclaration[]}
* @memberof ClassLikeDeclaration
*/
properties: PropertyDeclaration[];
/**
* The methods of the declaration.
*
* @type {MethodDeclaration[]}
* @memberof ClassLikeDeclaration
*/
methods: MethodDeclaration[];
/**
* The methods of the declaration.
*
* @type {InterfaceDeclaration[]}
* @memberof ClassLikeDeclaration
*/
implements: InterfaceDeclaration[];
/**
* The methods of the declaration.
*
* @type {ClassDeclaration[]}
* @memberof ClassLikeDeclaration
*/
extends: ClassDeclaration[];
}
/**
* Interface for callable declarations. Contains lists for parameters and used variables in the callable
* definitions.
*
* @export
* @interface CallableDeclaration
* @extends {Declaration}
*/
export interface CallableDeclaration extends Declaration {
/**
* List of used parameters in the callable node.
*
* @type {ParameterDeclaration[]}
* @memberof CallableDeclaration
*/
parameters: ParameterDeclaration[];
/**
* List of used variables in the callable node.
*
* @type {VariableDeclaration[]}
* @memberof CallableDeclaration
*/
variables: VariableDeclaration[];
}
/**
* Interface for possible abstract declarations. Contains information if the element is abstract or not.
*
* @export
* @interface AbstractDeclaration
* @extends {Declaration}
*/
export interface AbstractDeclaration extends Declaration {
/**
* Defines if the declaration is abstract or not.
*
* @type {boolean}
* @memberof AbstractDeclaration
*/
isAbstract: boolean;
}
/**
* Interface for possible optional declarations. Contains information if the element is optional or not.
*
* @export
* @interface OptionalDeclaration
* @extends {Declaration}
*/
export interface OptionalDeclaration extends Declaration {
/**
* Defines if the declaration is optional or not.
*
* @type {boolean}
* @memberof OptionalDeclaration
*/
isOptional: boolean;
}
/**
* Interface for possible static declarations.
*
* @export
* @interface StaticDeclaration
* @extends {Declaration}
*/
export interface StaticDeclaration extends Declaration {
/**
* Defines if the declaration is static or not.
*
* @type {boolean}
* @memberof StaticDeclaration
*/
isStatic: boolean;
}
/**
* Interface for possible async declarations.
*
* @export
* @interface AsyncDeclaration
* @extends {Declaration}
*/
export interface AsyncDeclaration extends Declaration {
/**
* Defines if the declaration is async or not.
*
* @type {boolean}
* @memberof AsyncDeclaration
*/
isAsync: boolean;
}