Skip to content

Commit c30ac1f

Browse files
Allow bypassing compiler errors, see #116
1 parent cdb7bc9 commit c30ac1f

File tree

5 files changed

+48
-2
lines changed

5 files changed

+48
-2
lines changed

bin/typedoc.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ declare module td {
276276
* Has an error been raised through the log method?
277277
*/
278278
hasErrors(): boolean;
279+
/**
280+
* Reset the error counter.
281+
*/
282+
resetErrors(): void;
279283
/**
280284
* Log the given message.
281285
*
@@ -403,6 +407,10 @@ declare module td {
403407
* Path and filename of the json file.
404408
*/
405409
json?: string;
410+
/**
411+
* Should TypeDoc generate documentation pages even after the compiler has returned errors?
412+
*/
413+
ignoreCompilerErrors?: boolean;
406414
/**
407415
* Does the user want to display the help message?
408416
*/

bin/typedoc.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,13 @@ var td;
430430
var result = this.converter.convert(src);
431431
if (result.errors && result.errors.length) {
432432
this.logger.diagnostics(result.errors);
433-
return null;
433+
if (this.options.ignoreCompilerErrors) {
434+
this.logger.resetErrors();
435+
return result.project;
436+
}
437+
else {
438+
return null;
439+
}
434440
}
435441
else {
436442
return result.project;
@@ -584,6 +590,12 @@ var td;
584590
Logger.prototype.hasErrors = function () {
585591
return this.errorCount > 0;
586592
};
593+
/**
594+
* Reset the error counter.
595+
*/
596+
Logger.prototype.resetErrors = function () {
597+
this.errorCount = 0;
598+
};
587599
/**
588600
* Log the given message.
589601
*
@@ -915,6 +927,10 @@ var td;
915927
name: 'exclude',
916928
help: 'Define a pattern for excluded files when specifying paths.',
917929
type: ParameterType.String
930+
}, {
931+
name: 'ignoreCompilerErrors',
932+
help: 'Should TypeDoc generate documentation pages even after the compiler has returned errors?',
933+
type: ParameterType.Boolean
918934
}, {
919935
name: 'plugin',
920936
help: 'Specify the npm plugins that should be loaded. Omit to load all installed plugins, set to \'none\' to load no plugins.',

src/td/Application.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,12 @@ module td
342342
var result = this.converter.convert(src);
343343
if (result.errors && result.errors.length) {
344344
this.logger.diagnostics(result.errors);
345-
return null;
345+
if (this.options.ignoreCompilerErrors) {
346+
this.logger.resetErrors();
347+
return result.project;
348+
} else {
349+
return null;
350+
}
346351
} else {
347352
return result.project;
348353
}

src/td/Logger.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ module td
4141
}
4242

4343

44+
/**
45+
* Reset the error counter.
46+
*/
47+
public resetErrors() {
48+
this.errorCount = 0;
49+
}
50+
51+
4452
/**
4553
* Log the given message.
4654
*

src/td/Options.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ declare module td
3232
*/
3333
json?:string;
3434

35+
/**
36+
* Should TypeDoc generate documentation pages even after the compiler has returned errors?
37+
*/
38+
ignoreCompilerErrors?:boolean;
39+
3540
/**
3641
* Does the user want to display the help message?
3742
*/
@@ -260,6 +265,10 @@ module td
260265
name: 'exclude',
261266
help: 'Define a pattern for excluded files when specifying paths.',
262267
type: ParameterType.String
268+
},{
269+
name: 'ignoreCompilerErrors',
270+
help: 'Should TypeDoc generate documentation pages even after the compiler has returned errors?',
271+
type: ParameterType.Boolean
263272
},{
264273
name: 'plugin',
265274
help: 'Specify the npm plugins that should be loaded. Omit to load all installed plugins, set to \'none\' to load no plugins.',

0 commit comments

Comments
 (0)