Skip to content

Commit 9b62f09

Browse files
committed
Fix output specific option specification
Resolves #2818
1 parent 53fa22e commit 9b62f09

File tree

4 files changed

+1
-38
lines changed

4 files changed

+1
-38
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ title: Changelog
88

99
- `@include` and `@includeCode` now work in the readme file, #2814.
1010
- TypeDoc will now avoid making references to references, #2811.
11+
- Fixed output specific option specification, #2818.
1112
- Improved type reference conversion to avoid including defaulted type arguments, #2820.
1213
- Improved link resolution logic to prioritize type alias properties with the
1314
same symbol over type literal properties within function parameters.

src/lib/application.ts

-4
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,6 @@ export class Application extends AbstractComponent<
361361
*/
362362
public async convert(): Promise<ProjectReflection | undefined> {
363363
const start = Date.now();
364-
// We freeze here rather than in the Converter class since TypeDoc's tests reuse the Application
365-
// with a few different settings.
366-
this.options.freeze();
367364
this.logger.verbose(
368365
`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`,
369366
);
@@ -431,7 +428,6 @@ export class Application extends AbstractComponent<
431428
public convertAndWatch(
432429
success: (project: ProjectReflection) => Promise<void>,
433430
): void {
434-
this.options.freeze();
435431
if (
436432
!this.options.getValue("preserveWatchOutput") &&
437433
this.logger instanceof ConsoleLogger

src/lib/utils/options/options.ts

-26
Original file line numberDiff line numberDiff line change
@@ -133,20 +133,6 @@ export class Options {
133133
return options;
134134
}
135135

136-
/**
137-
* Marks the options as readonly, enables caching when fetching options, which improves performance.
138-
*/
139-
freeze() {
140-
Object.freeze(this._values);
141-
}
142-
143-
/**
144-
* Checks if the options object has been frozen, preventing future changes to option values.
145-
*/
146-
isFrozen() {
147-
return Object.isFrozen(this._values);
148-
}
149-
150136
/**
151137
* Take a snapshot of option values now, used in tests only.
152138
* @internal
@@ -318,12 +304,6 @@ export class Options {
318304
configPath?: NeverIfInternal<string>,
319305
): void;
320306
setValue(name: string, value: unknown, configPath?: string): void {
321-
if (this.isFrozen()) {
322-
throw new Error(
323-
`Tried to modify an option (${name}) value after options have been frozen.`,
324-
);
325-
}
326-
327307
const declaration = this.getDeclaration(name);
328308
if (!declaration) {
329309
const nearNames = this.getSimilarOptions(name);
@@ -419,12 +399,6 @@ export class Options {
419399
options: ts.CompilerOptions,
420400
projectReferences: readonly ts.ProjectReference[] | undefined,
421401
) {
422-
if (this.isFrozen()) {
423-
throw new Error(
424-
"Tried to modify compiler options after options have been frozen.",
425-
);
426-
}
427-
428402
// We do this here instead of in the tsconfig reader so that API consumers which
429403
// supply a program to `Converter.convert` instead of letting TypeDoc create one
430404
// can just set the compiler options, and not need to know about this mapping.

src/test/utils/options/options.test.ts

-8
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,6 @@ describe("Options", () => {
162162
throws(() => options.isSet("does not exist" as never));
163163
});
164164

165-
it("Throws if frozen and a value is set", () => {
166-
const options = new Options(new Internationalization(null).proxy);
167-
options.freeze();
168-
169-
throws(() => options.setValue("categorizeByGroup", true));
170-
throws(() => options.setCompilerOptions([], {}, []));
171-
});
172-
173165
it("Supports resetting values", () => {
174166
const options = new Options(new Internationalization(null).proxy);
175167

0 commit comments

Comments
 (0)