Skip to content

Commit d02a980

Browse files
committed
Merge remote-tracking branch 'origin/skip-error-checking'
2 parents e9c3181 + 628470e commit d02a980

File tree

5 files changed

+57
-36
lines changed

5 files changed

+57
-36
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ labels: bug
1919
## Steps to reproduce the bug
2020

2121
<!--
22+
Note: Turn off skipErrorChecks before reporting a crash. Bug reports for crashes with that option
23+
on are out of scope.
24+
2225
If possible, please create a *minimal* repo reproducing your problem and link it.
2326
You can easily do this by submitting a pull request to https://github.com/TypeStrong/typedoc-repros
2427
which changes the files necessary to reproduce your bug.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Unreleased
22

3+
### Features
4+
5+
- Introduced a `skipErrorChecking` option which instructs TypeDoc to not ask TypeScript for compiler errors
6+
before attempting to generate documentation. Turning this on may improve generation speed, but could also
7+
cause a crash if your code contains compiler errors.
8+
39
### Bug Fixes
410

511
- Readme files within monorepos now have `@link` tags resolved, #2029.

src/lib/application.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ export class Application extends ChildableComponent<
8888

8989
/** @internal */
9090
@BindOption("logger")
91-
loggerType!: string | Function;
91+
readonly loggerType!: string | Function;
92+
93+
/** @internal */
94+
@BindOption("skipErrorChecking")
95+
readonly skipErrorChecking!: boolean;
9296

9397
/**
9498
* The version number of TypeDoc.
@@ -216,12 +220,14 @@ export class Application extends ChildableComponent<
216220
`Converting with ${programs.length} programs ${entryPoints.length} entry points`
217221
);
218222

219-
const errors = programs.flatMap((program) =>
220-
ts.getPreEmitDiagnostics(program)
221-
);
222-
if (errors.length) {
223-
this.logger.diagnostics(errors);
224-
return;
223+
if (this.skipErrorChecking === false) {
224+
const errors = programs.flatMap((program) =>
225+
ts.getPreEmitDiagnostics(program)
226+
);
227+
if (errors.length) {
228+
this.logger.diagnostics(errors);
229+
return;
230+
}
225231
}
226232

227233
if (this.options.getValue("emit") === "both") {

src/lib/utils/options/declaration.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -76,75 +76,75 @@ export type TypeDocOptionValues = {
7676
export interface TypeDocOptionMap {
7777
options: string;
7878
tsconfig: string;
79+
compilerOptions: unknown;
7980

8081
entryPoints: string[];
8182
entryPointStrategy: typeof EntryPointStrategy;
8283

8384
exclude: string[];
8485
externalPattern: string[];
8586
excludeExternals: boolean;
86-
excludePrivate: boolean;
87-
excludeProtected: boolean;
8887
excludeNotDocumented: boolean;
8988
excludeInternal: boolean;
90-
disableSources: boolean;
91-
basePath: string;
92-
includes: string;
89+
excludePrivate: boolean;
90+
excludeProtected: boolean;
9391
media: string;
94-
95-
emit: typeof EmitStrategy;
96-
watch: boolean;
97-
preserveWatchOutput: boolean;
92+
includes: string;
9893

9994
out: string;
10095
json: string;
10196
pretty: boolean;
102-
97+
emit: typeof EmitStrategy;
10398
theme: string;
99+
104100
lightHighlightTheme: ShikiTheme;
105101
darkHighlightTheme: ShikiTheme;
106102
customCss: string;
107-
visibilityFilters: ManuallyValidatedOption<{
108-
protected?: boolean;
109-
private?: boolean;
110-
inherited?: boolean;
111-
external?: boolean;
112-
[tag: `@${string}`]: boolean;
113-
}>;
114-
103+
markedOptions: unknown;
115104
name: string;
116105
includeVersion: boolean;
106+
disableSources: boolean;
107+
basePath: string;
108+
excludeTags: `@${string}`[];
117109
readme: string;
118-
defaultCategory: string;
119-
categoryOrder: string[];
120-
categorizeByGroup: boolean;
121110
cname: string;
122-
sort: SortStrategy[];
123111
gitRevision: string;
124112
gitRemote: string;
125-
gaID: string;
126-
githubPages: boolean;
127113
htmlLang: string;
114+
githubPages: boolean;
115+
gaID: string;
128116
hideGenerator: boolean;
129117
searchInComments: boolean;
130118
cleanOutputDir: boolean;
131119

132120
commentStyle: typeof CommentStyle;
133-
excludeTags: `@${string}`[];
134121
blockTags: `@${string}`[];
135122
inlineTags: `@${string}`[];
136123
modifierTags: `@${string}`[];
137124

125+
categorizeByGroup: boolean;
126+
defaultCategory: string;
127+
categoryOrder: string[];
128+
sort: SortStrategy[];
129+
visibilityFilters: ManuallyValidatedOption<{
130+
protected?: boolean;
131+
private?: boolean;
132+
inherited?: boolean;
133+
external?: boolean;
134+
[tag: `@${string}`]: boolean;
135+
}>;
136+
searchCategoryBoosts: ManuallyValidatedOption<Record<string, number>>;
137+
searchGroupBoosts: ManuallyValidatedOption<Record<string, number>>;
138+
139+
watch: boolean;
140+
preserveWatchOutput: boolean;
141+
skipErrorChecking: boolean;
138142
help: boolean;
139143
version: boolean;
140144
showConfig: boolean;
141145
plugin: string[];
142-
searchCategoryBoosts: ManuallyValidatedOption<Record<string, number>>;
143-
searchGroupBoosts: ManuallyValidatedOption<Record<string, number>>;
144146
logger: unknown; // string | Function
145147
logLevel: typeof LogLevel;
146-
markedOptions: unknown;
147-
compilerOptions: unknown;
148148

149149
// Validation
150150
treatWarningsAsErrors: boolean;

src/lib/utils/options/sources/typedoc.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,12 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
466466
type: ParameterType.Boolean,
467467
});
468468

469+
options.addDeclaration({
470+
name: "skipErrorChecking",
471+
help: "Do not run TypeScript's type checking before generating docs.",
472+
type: ParameterType.Boolean,
473+
defaultValue: false,
474+
});
469475
options.addDeclaration({
470476
name: "help",
471477
help: "Print this message.",

0 commit comments

Comments
 (0)