Skip to content

Commit

Permalink
Fix output specific option specification
Browse files Browse the repository at this point in the history
Resolves #2818
  • Loading branch information
Gerrit0 committed Dec 25, 2024
1 parent 53fa22e commit 9b62f09
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 38 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ title: Changelog

- `@include` and `@includeCode` now work in the readme file, #2814.
- TypeDoc will now avoid making references to references, #2811.
- Fixed output specific option specification, #2818.
- Improved type reference conversion to avoid including defaulted type arguments, #2820.
- Improved link resolution logic to prioritize type alias properties with the
same symbol over type literal properties within function parameters.
Expand Down
4 changes: 0 additions & 4 deletions src/lib/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,6 @@ export class Application extends AbstractComponent<
*/
public async convert(): Promise<ProjectReflection | undefined> {
const start = Date.now();
// We freeze here rather than in the Converter class since TypeDoc's tests reuse the Application
// with a few different settings.
this.options.freeze();
this.logger.verbose(
`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`,
);
Expand Down Expand Up @@ -431,7 +428,6 @@ export class Application extends AbstractComponent<
public convertAndWatch(
success: (project: ProjectReflection) => Promise<void>,
): void {
this.options.freeze();
if (
!this.options.getValue("preserveWatchOutput") &&
this.logger instanceof ConsoleLogger
Expand Down
26 changes: 0 additions & 26 deletions src/lib/utils/options/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,6 @@ export class Options {
return options;
}

/**
* Marks the options as readonly, enables caching when fetching options, which improves performance.
*/
freeze() {
Object.freeze(this._values);
}

/**
* Checks if the options object has been frozen, preventing future changes to option values.
*/
isFrozen() {
return Object.isFrozen(this._values);
}

/**
* Take a snapshot of option values now, used in tests only.
* @internal
Expand Down Expand Up @@ -318,12 +304,6 @@ export class Options {
configPath?: NeverIfInternal<string>,
): void;
setValue(name: string, value: unknown, configPath?: string): void {
if (this.isFrozen()) {
throw new Error(
`Tried to modify an option (${name}) value after options have been frozen.`,
);
}

const declaration = this.getDeclaration(name);
if (!declaration) {
const nearNames = this.getSimilarOptions(name);
Expand Down Expand Up @@ -419,12 +399,6 @@ export class Options {
options: ts.CompilerOptions,
projectReferences: readonly ts.ProjectReference[] | undefined,
) {
if (this.isFrozen()) {
throw new Error(
"Tried to modify compiler options after options have been frozen.",
);
}

// We do this here instead of in the tsconfig reader so that API consumers which
// supply a program to `Converter.convert` instead of letting TypeDoc create one
// can just set the compiler options, and not need to know about this mapping.
Expand Down
8 changes: 0 additions & 8 deletions src/test/utils/options/options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,6 @@ describe("Options", () => {
throws(() => options.isSet("does not exist" as never));
});

it("Throws if frozen and a value is set", () => {
const options = new Options(new Internationalization(null).proxy);
options.freeze();

throws(() => options.setValue("categorizeByGroup", true));
throws(() => options.setCompilerOptions([], {}, []));
});

it("Supports resetting values", () => {
const options = new Options(new Internationalization(null).proxy);

Expand Down

0 comments on commit 9b62f09

Please sign in to comment.