forked from TypeStrong/typedoc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypedoc.d.ts
4163 lines (4163 loc) · 146 KB
/
typedoc.d.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
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/// <reference path="../src/lib/tsd.d.ts" />
declare module td {
var Util: any;
var VM: any;
var Path: any;
var Handlebars: HandlebarsStatic;
var Marked: MarkedStatic;
var HighlightJS: any;
var Minimatch: any;
var FS: any;
var ShellJS: any;
var ProgressBar: any;
var tsPath: string;
}
declare module td {
interface IListener {
handler: Function;
scope: any;
priority: number;
}
/**
* Base class of all events.
*
* Events are emitted by [[EventDispatcher]] and are passed to all
* handlers registered for the associated event name.
*/
class Event {
/**
* Has [[Event.stopPropagation]] been called?
*/
isPropagationStopped: boolean;
/**
* Has [[Event.preventDefault]] been called?
*/
isDefaultPrevented: boolean;
/**
* Stop the propagation of this event. Remaining event handlers will not be executed.
*/
stopPropagation(): void;
/**
* Prevent the default action associated with this event from being executed.
*/
preventDefault(): void;
}
/**
* Base class of all objects dispatching events.
*
* Events are dispatched by calling [[EventDispatcher.dispatch]]. Events must have a name and
* they can carry additional arguments that are passed to all handlers. The first argument can
* be an instance of [[Event]] providing additional functionality.
*/
class EventDispatcher {
/**
* List of all registered handlers grouped by event name.
*/
private listeners;
/**
* Dispatch an event with the given event name.
*
* @param event The name of the event to dispatch.
* @param args Additional arguments to pass to the handlers.
*/
dispatch(event: string, ...args: any[]): void;
/**
* Register an event handler for the given event name.
*
* @param event The name of the event the handler should be registered to.
* @param handler The callback that should be invoked.
* @param scope The scope the callback should be executed in.
* @param priority A numeric value describing the priority of the handler. Handlers
* with higher priority will be executed earlier.
*/
on(event: string, handler: Function, scope?: any, priority?: number): void;
/**
* Remove an event handler.
*
* @param event The name of the event whose handlers should be removed.
* @param handler The callback that should be removed.
* @param scope The scope of the callback that should be removed.
*/
off(event?: string, handler?: Function, scope?: any): void;
}
}
/**
* The TypeDoc main module and namespace.
*
* The [[Application]] class holds the core logic of the cli application. All code related
* to resolving reflections is stored in [[TypeDoc.Factories]], the actual data models can be found
* in [[TypeDoc.Models]] and the final rendering is defined in [[TypeDoc.Output]].
*/
declare module td {
/**
* An interface of the application class.
*
* All classes should expect this interface allowing other third parties
* to use their own implementation.
*/
interface IApplication {
/**
* The options used by the dispatcher and the renderer.
*/
options: IOptions;
/**
* The options used by the TypeScript compiler.
*/
compilerOptions: ts.CompilerOptions;
/**
* The logger that should be used to output messages.
*/
logger: Logger;
}
/**
* The default TypeDoc main application class.
*
* This class holds the two main components of TypeDoc, the [[Dispatcher]] and
* the [[Renderer]]. When running TypeDoc, first the [[Dispatcher]] is invoked which
* generates a [[ProjectReflection]] from the passed in source files. The
* [[ProjectReflection]] is a hierarchical model representation of the TypeScript
* project. Afterwards the model is passed to the [[Renderer]] which uses an instance
* of [[BaseTheme]] to generate the final documentation.
*
* Both the [[Dispatcher]] and the [[Renderer]] are subclasses of the [[EventDispatcher]]
* and emit a series of events while processing the project. Subscribe to these Events
* to control the application flow or alter the output.
*/
class Application extends EventDispatcher implements IApplication {
/**
* The options used by the dispatcher and the renderer.
*/
options: IOptions;
/**
* The options used by the TypeScript compiler.
*/
compilerOptions: ts.CompilerOptions;
/**
* The converter used to create the declaration reflections.
*/
converter: converter.Converter;
/**
* The renderer used to generate the documentation output.
*/
renderer: output.Renderer;
/**
* The logger that should be used to output messages.
*/
logger: Logger;
/**
* The version number of the loaded TypeScript compiler.
* Cached return value of [[Application.getTypeScriptVersion]]
*/
private typeScriptVersion;
/**
*
* @event
*/
static EVENT_COLLECT_PARAMETERS: string;
/**
* The version number of TypeDoc.
*/
static VERSION: string;
/**
* @param options An object containing the options that should be used.
*/
constructor(options?: IOptions);
/**
* @param fromCommandLine TRUE if the application should execute in command line mode.
*/
constructor(fromCommandLine: boolean);
/**
* Generic initialization logic.
*/
private bootstrap();
/**
* Run TypeDoc from the command line.
*/
private bootstrapFromCommandline();
/**
* Initialize TypeDoc with the given options object.
*
* @param options The desired options to set.
*/
private bootstrapWithOptions(options?);
/**
* Load the given list of npm plugins.
*
* @param plugins A list of npm modules that should be loaded as plugins. When not specified
* this function will invoke [[discoverNpmPlugins]] to find a list of all installed plugins.
* @returns TRUE on success, otherwise FALSE.
*/
private loadNpmPlugins(plugins?);
/**
* Discover all installed TypeDoc plugins.
*
* @returns A list of all npm module names that are qualified TypeDoc plugins.
*/
private discoverNpmPlugins();
/**
* Allow [[Converter]] and [[Renderer]] to add parameters to the given [[OptionsParser]].
*
* @param parser The parser instance the found parameters should be added to.
*/
collectParameters(parser: OptionsParser): void;
/**
* Run the converter for the given set of files and return the generated reflections.
*
* @param src A list of source that should be compiled and converted.
* @returns An instance of ProjectReflection on success, NULL otherwise.
*/
convert(src: string[]): models.ProjectReflection;
/**
* @param src A list of source files whose documentation should be generated.
*/
generateDocs(src: string[], out: string): boolean;
/**
* @param project The project the documentation should be generated for.
*/
generateDocs(project: models.ProjectReflection, out: string): boolean;
/**
* @param src A list of source that should be compiled and converted.
*/
generateJson(src: string[], out: string): boolean;
/**
* @param project The project that should be converted.
*/
generateJson(project: models.ProjectReflection, out: string): boolean;
/**
* Expand a list of input files.
*
* Searches for directories in the input files list and replaces them with a
* listing of all TypeScript files within them. One may use the ```--exclude``` option
* to filter out files with a pattern.
*
* @param inputFiles The list of files that should be expanded.
* @returns The list of input files with expanded directories.
*/
expandInputFiles(inputFiles?: string[]): string[];
/**
* Return the version number of the loaded TypeScript compiler.
*
* @returns The version number of the loaded TypeScript package.
*/
getTypeScriptVersion(): string;
/**
* Print the version number.
*/
toString(): string;
}
}
declare module td {
/**
* List of known log levels. Used to specify the urgency of a log message.
*/
enum LogLevel {
Info = 0,
Warn = 1,
Error = 2,
Success = 3,
}
enum LoggerType {
None = 0,
Console = 1,
}
/**
* A logger that will not produce any output.
*
* This logger also serves as the ase calls of other loggers as it implements
* all the required utility functions.
*/
class Logger {
/**
* How many error messages have been logged?
*/
errorCount: number;
/**
* Has an error been raised through the log method?
*/
hasErrors(): boolean;
/**
* Log the given message.
*
* @param text The message that should be logged.
* @param args The arguments that should be printed into the given message.
*/
write(text: string, ...args: string[]): void;
/**
* Log the given message with a trailing whitespace.
*
* @param text The message that should be logged.
* @param args The arguments that should be printed into the given message.
*/
writeln(text: string, ...args: string[]): void;
/**
* Log the given success message.
*
* @param text The message that should be logged.
* @param args The arguments that should be printed into the given message.
*/
success(text: string, ...args: string[]): void;
/**
* Log the given warning.
*
* @param text The warning that should be logged.
* @param args The arguments that should be printed into the given warning.
*/
warn(text: string, ...args: string[]): void;
/**
* Log the given error.
*
* @param text The error that should be logged.
* @param args The arguments that should be printed into the given error.
*/
error(text: string, ...args: string[]): void;
/**
* Print a log message.
*
* @param message The message itself.
* @param level The urgency of the log message.
* @param newLine Should the logger print a trailing whitespace?
*/
log(message: string, level?: LogLevel, newLine?: boolean): void;
/**
* Print the given TypeScript log messages.
*
* @param diagnostics The TypeScript messages that should be logged.
*/
diagnostics(diagnostics: ts.Diagnostic[]): void;
/**
* Print the given TypeScript log message.
*
* @param diagnostic The TypeScript message that should be logged.
*/
diagnostic(diagnostic: ts.Diagnostic): void;
}
/**
* A logger that outputs all messages to the console.
*/
class ConsoleLogger extends Logger {
/**
* Print a log message.
*
* @param message The message itself.
* @param level The urgency of the log message.
* @param newLine Should the logger print a trailing whitespace?
*/
log(message: string, level?: LogLevel, newLine?: boolean): void;
}
/**
* A logger that calls a callback function.
*/
class CallbackLogger extends Logger {
/**
* This loggers callback function
*/
callback: Function;
/**
* Create a new CallbackLogger instance.
*
* @param callback The callback that should be used to log messages.
*/
constructor(callback: Function);
/**
* Print a log message.
*
* @param message The message itself.
* @param level The urgency of the log message.
* @param newLine Should the logger print a trailing whitespace?
*/
log(message: string, level?: LogLevel, newLine?: boolean): void;
}
}
declare module td {
/**
* Options object interface declaration.
*
* Other components might add additional option declarations.
*/
interface IOptions {
/**
* The path of the theme that should be used.
*/
theme: string;
/**
* The list of npm plugins that should be loaded.
*/
plugins?: string[];
/**
* A pattern for files that should be excluded when a path is specified as source.
*/
exclude?: string;
/**
* The path of the output directory.
*/
out?: string;
/**
* Path and filename of the json file.
*/
json?: string;
/**
* Does the user want to display the help message?
*/
help?: boolean;
/**
* Does the user want to know the version number?
*/
version?: boolean;
/**
* Which logger should be used to record messages?
*/
logger?: LoggerType;
}
}
declare module td {
enum ModuleKind {
None = 0,
CommonJS = 1,
AMD = 2,
}
enum ScriptTarget {
ES3 = 0,
ES5 = 1,
ES6 = 2,
Latest = 2,
}
enum SourceFileMode {
File = 0,
Modules = 1,
}
interface IParameter {
name: string;
short?: string;
help: string;
type?: ParameterType;
hint?: ParameterHint;
scope?: ParameterScope;
map?: {};
mapError?: string;
isArray?: boolean;
defaultValue?: any;
convert?: (param: IParameter, value?: any) => any;
}
interface IParameterHelp {
names: string[];
helps: string[];
margin: number;
}
interface IParameterProvider {
/**
* Return a list of parameters introduced by this component.
*
* @returns A list of parameter definitions introduced by this component.
*/
getParameters(): IParameter[];
}
enum ParameterHint {
File = 0,
Directory = 1,
}
enum ParameterType {
String = 0,
Number = 1,
Boolean = 2,
Map = 3,
}
enum ParameterScope {
TypeDoc = 0,
TypeScript = 1,
}
/**
* A parser that can read command line arguments, option files and javascript objects.
*/
class OptionsParser {
/**
* The list of discovered input files.
*/
inputFiles: string[];
/**
* The application that stores the parsed settings.
*/
private application;
/**
* Map of parameter names and their definitions.
*/
private arguments;
/**
* Map of parameter short names and their full equivalent.
*/
private shortNames;
/**
* A list of all TypeScript parameters that should be ignored.
*/
private static IGNORED_TS_PARAMS;
/**
* The name of the parameter that specifies the options file.
*/
private static OPTIONS_KEY;
/**
* Create a new OptionsParser instance.
*
* @param application The application that stores the parsed settings
*/
constructor(application: IApplication);
/**
* @param parameters One or multiple parameter definitions that should be registered.
*/
addParameter(parameters: IParameter[]): any;
/**
* @param rest One or multiple parameter definitions that should be registered.
*/
addParameter(...rest: IParameter[]): any;
/**
* Register the command line parameters.
*/
addCommandLineParameters(): void;
/**
* Register the default parameters.
*/
private addDefaultParameters();
/**
* Register all TypeScript related properties.
*/
private addCompilerParameters();
/**
* Add an input/source file.
*
* The input files will be used as source files for the compiler. All command line
* arguments without parameter will be interpreted as being input files.
*
* @param fileName The path and filename of the input file.
*/
addInputFile(fileName: string): void;
/**
* Retrieve a parameter by its name.
*
* @param name The name of the parameter to look for.
* @returns The parameter definition or NULL when not found.
*/
getParameter(name: string): IParameter;
/**
* Return all parameters within the given scope.
*
* @param scope The scope the parameter list should be filtered for.
* @returns All parameters within the given scope
*/
getParametersByScope(scope: ParameterScope): IParameter[];
/**
* Set the option described by the given parameter description to the given value.
*
* @param param The parameter description of the option to set.
* @param value The target value of the option.
* @returns TRUE on success, otherwise FALSE.
*/
setOption(param: IParameter, value?: any): boolean;
/**
* Try to find and load an option file from command line arguments.
*
* An option file can either be specified using the command line argument ``--option`` or must
* be a file named ``typedoc.js`` within the current directory.
*
* @param args The list of arguments that should be parsed. When omitted the
* current command line arguments will be used.
* @param ignoreUnknownArgs Should unknown arguments be ignored? If so the parser
* will simply skip all unknown arguments.
* @returns TRUE on success, otherwise FALSE.
*/
loadOptionFileFromArguments(args?: string[], ignoreUnknownArgs?: boolean): boolean;
/**
* Try to load an option file from a settings object.
*
* @param obj The object whose properties should be applied.
* @param ignoreUnknownArgs Should unknown arguments be ignored? If so the parser
* will simply skip all unknown arguments.
* @returns TRUE on success, otherwise FALSE.
*/
loadOptionFileFromObject(obj: any, ignoreUnknownArgs?: boolean): boolean;
/**
* Load the specified option file.
*
* @param optionFile The absolute path and file name of the option file.
* @param ignoreUnknownArgs Should unknown arguments be ignored? If so the parser
* will simply skip all unknown arguments.
* @returns TRUE on success, otherwise FALSE.
*/
loadOptionFile(optionFile: string, ignoreUnknownArgs?: boolean): boolean;
/**
* Apply the values of the given options object.
*
* @param obj The object whose properties should be applied.
* @param ignoreUnknownArgs Should unknown arguments be ignored? If so the parser
* will simply skip all unknown arguments.
* @returns TRUE on success, otherwise FALSE.
*/
parseObject(obj: any, ignoreUnknownArgs?: boolean): boolean;
/**
* Read and store the given list of arguments.
*
* @param args The list of arguments that should be parsed. When omitted the
* current command line arguments will be used.
* @param ignoreUnknownArgs Should unknown arguments be ignored? If so the parser
* will simply skip all unknown arguments.
* @returns TRUE on success, otherwise FALSE.
*/
parseArguments(args?: string[], ignoreUnknownArgs?: boolean): boolean;
/**
* Read the arguments stored in the given file.
*
* @param filename The path and filename that should be parsed.
* @param ignoreUnknownArgs Should unknown arguments be ignored?
* @returns TRUE on success, otherwise FALSE.
*/
parseResponseFile(filename: string, ignoreUnknownArgs?: boolean): boolean;
/**
* Prepare parameter information for the [[toString]] method.
*
* @param scope The scope of the parameters whose help should be returned.
* @returns The columns and lines for the help of the requested parameters.
*/
private getParameterHelp(scope);
/**
* Print some usage information.
*
* Taken from TypeScript (src/compiler/tsc.ts)
*/
toString(): string;
/**
* Convert the given value according to the type setting of the given parameter.
*
* @param param The parameter definition.
* @param value The value that should be converted.
* @returns The converted value.
*/
static convert(param: IParameter, value?: any): any;
/**
* Create an options object populated with the default values.
*
* @returns An options object populated with default values.
*/
static createOptions(): IOptions;
/**
* Create the compiler options populated with the default values.
*
* @returns A compiler options object populated with default values.
*/
static createCompilerOptions(): ts.CompilerOptions;
}
}
declare module td {
interface IPluginInterface {
remove(): any;
}
interface IPluginClass<T extends IPluginInterface> {
new (instance: PluginHost<T>): T;
}
class PluginHost<T extends IPluginInterface> extends EventDispatcher implements IParameterProvider {
/**
* List of all plugins that are attached to this host.
*/
plugins: {
[name: string]: T;
};
static PLUGINS: {
[name: string]: IPluginClass<IPluginInterface>;
};
getParameters(): IParameter[];
/**
* Retrieve a plugin instance.
*
* @returns The instance of the plugin or NULL if no plugin with the given class is attached.
*/
getPlugin(name: string): T;
addPlugin(name: string, pluginClass: IPluginClass<T>): T;
removePlugin(name: string): boolean;
removeAllPlugins(): void;
static registerPlugin<T extends IPluginInterface>(name: string, pluginClass: IPluginClass<T>): void;
static loadPlugins<T extends IPluginInterface>(instance: PluginHost<T>): void;
}
}
declare module td {
/**
* Normalize the given path.
*
* @param path The path that should be normalized.
* @returns The normalized path.
*/
function normalizePath(path: string): string;
/**
* Test whether the given directory exists.
*
* @param directoryPath The directory that should be tested.
* @returns TRUE if the given directory exists, FALSE otherwise.
*/
function directoryExists(directoryPath: string): boolean;
/**
* Make sure that the given directory exists.
*
* @param directoryPath The directory that should be validated.
*/
function ensureDirectoriesExist(directoryPath: string): void;
/**
* Write a file to disc.
*
* If the containing directory does not exist it will be created.
*
* @param fileName The name of the file that should be written.
* @param data The contents of the file.
* @param writeByteOrderMark Whether the UTF-8 BOM should be written or not.
* @param onError A callback that will be invoked if an error occurs.
*/
function writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
}
declare module td.converter {
/**
* Helper class that determines the common base path of a set of files.
*
* In the first step all files must be passed to [[add]]. Afterwards [[trim]]
* can be used to retrieve the shortest path relative to the determined base path.
*/
class BasePath {
/**
* List of known base paths.
*/
private basePaths;
/**
* Add the given file path to this set of base paths.
*
* @param fileName The absolute filename that should be added to the base path.
*/
add(fileName: string): void;
/**
* Trim the given filename by the determined base paths.
*
* @param fileName The absolute filename that should be trimmed.
* @returns The trimmed version of the filename.
*/
trim(fileName: string): string;
/**
* Reset this instance, ignore all paths already passed to [[add]].
*/
reset(): void;
/**
* Normalize the given path.
*
* @param path The path that should be normalized.
* @returns Normalized version of the given path.
*/
static normalize(path: string): string;
}
}
declare module td.converter {
/**
* The context describes the current state the converter is in.
*/
class Context {
/**
* The converter instance that has created the context.
*/
converter: Converter;
/**
* A list of all files that have been passed to the TypeScript compiler.
*/
fileNames: string[];
/**
* The TypeChecker instance returned by the TypeScript compiler.
*/
checker: ts.TypeChecker;
/**
* The program that is currently processed.
*/
program: ts.Program;
/**
* The project that is currently processed.
*/
project: models.ProjectReflection;
/**
* The scope or parent reflection that is currently processed.
*/
scope: models.Reflection;
/**
* Is the current source file marked as being external?
*/
isExternal: boolean;
/**
* Is the current source file a declaration file?
*/
isDeclaration: boolean;
/**
* The currently set type parameters.
*/
typeParameters: ts.Map<models.Type>;
/**
* The currently set type arguments.
*/
typeArguments: models.Type[];
/**
* Is the converter in inheritance mode?
*/
isInherit: boolean;
/**
* The node that has started the inheritance mode.
*/
inheritParent: ts.Node;
/**
* List symbol ids of inherited children already visited while inheriting.
*/
inheritedChildren: number[];
/**
* The names of the children of the scope before inheritance has been started.
*/
inherited: string[];
/**
* Next free symbol id used by [[getSymbolID]].
*/
private symbolID;
/**
* The pattern that should be used to flag external source files.
*/
private externalPattern;
/**
* Create a new Context instance.
*
* @param converter The converter instance that has created the context.
* @param fileNames A list of all files that have been passed to the TypeScript compiler.
* @param checker The TypeChecker instance returned by the TypeScript compiler.
*/
constructor(converter: Converter, fileNames: string[], checker: ts.TypeChecker, program: ts.Program);
/**
* Return the current TypeDoc options object.
*/
getOptions(): IOptions;
/**
* Return the compiler options.
*/
getCompilerOptions(): ts.CompilerOptions;
/**
* Return the type declaration of the given node.
*
* @param node The TypeScript node whose type should be resolved.
* @returns The type declaration of the given node.
*/
getTypeAtLocation(node: ts.Node): ts.Type;
/**
* Return the current logger instance.
*
* @returns The current logger instance.
*/
getLogger(): Logger;
/**
* Return the symbol id of the given symbol.
*
* The compiler sometimes does not assign an id to symbols, this method makes sure that we have one.
* It will assign negative ids if they are not set.
*
* @param symbol The symbol whose id should be returned.
* @returns The id of the given symbol.
*/
getSymbolID(symbol: ts.Symbol): number;
/**
* Register a newly generated reflection.
*
* Ensures that the reflection is both listed in [[Project.reflections]] and
* [[Project.symbolMapping]] if applicable.
*
* @param reflection The reflection that should be registered.
* @param node The node the given reflection was resolved from.
* @param symbol The symbol the given reflection was resolved from.
*/
registerReflection(reflection: models.Reflection, node: ts.Node, symbol?: ts.Symbol): void;
/**
* Trigger a node reflection event.
*
* All events are dispatched on the current converter instance.
*
* @param name The name of the event that should be triggered.
* @param reflection The triggering reflection.
* @param node The triggering TypeScript node if available.
*/
trigger(name: string, reflection: models.Reflection, node?: ts.Node): void;
/**
* Run the given callback with the context configured for the given source file.
*
* @param node The TypeScript node containing the source file declaration.
* @param callback The callback that should be executed.
*/
withSourceFile(node: ts.SourceFile, callback: Function): void;
/**
* @param callback The callback function that should be executed with the changed context.
*/
withScope(scope: models.Reflection, callback: Function): any;
/**
* @param parameters An array of type parameters that should be set on the context while the callback is invoked.
* @param callback The callback function that should be executed with the changed context.
*/
withScope(scope: models.Reflection, parameters: ts.NodeArray<ts.TypeParameterDeclaration>, callback: Function): any;
/**
* @param parameters An array of type parameters that should be set on the context while the callback is invoked.
* @param preserve Should the currently set type parameters of the context be preserved?
* @param callback The callback function that should be executed with the changed context.
*/
withScope(scope: models.Reflection, parameters: ts.NodeArray<ts.TypeParameterDeclaration>, preserve: boolean, callback: Function): any;
/**
* Inherit the children of the given TypeScript node to the current scope.
*
* @param baseNode The node whose children should be inherited.
* @param typeArguments The type arguments that apply while inheriting the given node.
* @return The resulting reflection / the current scope.
*/
inherit(baseNode: ts.Node, typeArguments?: ts.NodeArray<ts.TypeNode>): models.Reflection;
/**
* Convert the given list of type parameter declarations into a type mapping.
*
* @param parameters The list of type parameter declarations that should be converted.
* @param preserve Should the currently set type parameters of the context be preserved?
* @returns The resulting type mapping.
*/
private extractTypeParameters(parameters, preserve?);
}
}
declare module td {
interface IOptions {
/**
* The human readable name of the project. Used within the templates to set the title of the document.
*/
name?: string;
/**
* Specifies the output mode the project is used to be compiled with.
*/
mode?: SourceFileMode;
/**
* Define a pattern for files that should be considered being external.
*/
externalPattern?: string;
/**
* Should declaration files be documented?
*/
includeDeclarations?: boolean;
/**
* Should externally resolved TypeScript files be ignored?
*/
excludeExternals?: boolean;
/**
* Should symbols that are not marked as being exported be ignored?
*/
excludeNotExported?: boolean;
}
}
declare module td.converter {
/**
* Result structure of the [[Converter.convert]] method.
*/
interface IConverterResult {
/**
* An array containing all errors generated by the TypeScript compiler.
*/
errors: ts.Diagnostic[];
/**
* The resulting project reflection.
*/
project: models.ProjectReflection;
}
/**
* Compiles source files using TypeScript and converts compiler symbols to reflections.
*/
class Converter extends PluginHost<ConverterPlugin> implements ts.CompilerHost {
/**
* The host application of this converter instance.
*/
application: IApplication;
/**
* The full path of the current directory. Result cache of [[getCurrentDirectory]].
*/
private currentDirectory;
/**
* Return code of ts.sys.readFile when the file encoding is unsupported.
*/
static ERROR_UNSUPPORTED_FILE_ENCODING: number;
/**
* General events
*/
/**
* Triggered when the converter begins converting a project.
* The listener should implement [[IConverterCallback]].
* @event
*/
static EVENT_BEGIN: string;
/**
* Triggered when the converter has finished converting a project.
* The listener should implement [[IConverterCallback]].
* @event
*/
static EVENT_END: string;
/**
* Factory events
*/
/**
* Triggered when the converter begins converting a source file.
* The listener should implement [[IConverterNodeCallback]].
* @event
*/
static EVENT_FILE_BEGIN: string;
/**
* Triggered when the converter has created a declaration reflection.