Skip to content

Commit

Permalink
Reset options when copying for packages mode
Browse files Browse the repository at this point in the history
Resolves #2433

Co-Authored-By: @ocavue
  • Loading branch information
Gerrit0 committed Nov 3, 2023
1 parent 2f8a83e commit c86f4a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

### Bug Fixes

- Fixed an infinite loop when `skipLibCheck` is used to ignore some compiler errors, #2438.
- Fixed default option values on options declared by plugins in packages mode, #2433.
- `gitRevision` will now be replaced in `sourceLinkTemplate`, #2434.
- Fixed an infinite loop when `skipLibCheck` is used to ignore some compiler errors, #2438.

### Thanks!

- @ocavue
- @swarnpallav

## v0.25.3 (2023-10-29)
Expand Down
13 changes: 8 additions & 5 deletions src/lib/utils/options/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export class Options {
(reader) => reader.supportsPackages,
);
options._declarations = new Map(this._declarations);
options.reset();

return options;
}
Expand Down Expand Up @@ -168,7 +169,7 @@ export class Options {
const declaration = this.getDeclaration(name);
if (!declaration) {
throw new Error(
"Cannot reset an option which has not been declared.",
`Cannot reset an option (${name}) which has not been declared.`,
);
}

Expand Down Expand Up @@ -251,7 +252,9 @@ export class Options {
isSet(name: NeverIfInternal<string>): boolean;
isSet(name: string): boolean {
if (!this._declarations.has(name)) {
throw new Error("Tried to check if an undefined option was set");
throw new Error(
`Tried to check if an undefined option (${name}) was set`,
);
}
return this._setOptions.has(name);
}
Expand Down Expand Up @@ -302,7 +305,7 @@ export class Options {
setValue(name: string, value: unknown, configPath?: string): void {
if (this.isFrozen()) {
throw new Error(
"Tried to modify an option value after options have been frozen.",
`Tried to modify an option (${name}) value after options have been frozen.`,
);
}

Expand Down Expand Up @@ -385,7 +388,7 @@ export class Options {
) {
if (this.isFrozen()) {
throw new Error(
"Tried to modify an option value after options have been sealed.",
"Tried to modify compiler options after options have been frozen.",
);
}

Expand Down Expand Up @@ -454,7 +457,7 @@ export function Option<K extends keyof TypeDocOptionMap>(name: K) {
},
set(_value: never) {
throw new Error(
"Options may not be set via the Option decorator",
`Options may not be set via the Option decorator when setting ${name}`,
);
},
};
Expand Down

0 comments on commit c86f4a9

Please sign in to comment.