Skip to content

Commit 4350d47

Browse files
committed
Fix validation for requiredToBeDocumented
Closes #1872
1 parent eab5dd4 commit 4350d47

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
- Add support for TypeScript 4.6, #1877.
66
- Support copying `@param` comments for nested members that target union and intersection types, #1876.
77

8+
### Bug Fixes
9+
10+
- Fixed validation for `--requiredToBeDocumented` option, #1872.
11+
812
## v0.22.12 (2022-02-20)
913

1014
### Features

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
354354
);
355355

356356
for (const kind of values) {
357-
if (validValues.includes(kind)) {
357+
if (!validValues.includes(kind)) {
358358
throw new Error(
359359
`'${kind}' is an invalid value for 'requiredToBeDocumented'. Must be one of: ${validValues.join(
360360
", "

src/test/utils/options/default-options.test.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ok, throws, strictEqual } from "assert";
1+
import { ok, throws, strictEqual, doesNotThrow } from "assert";
22
import { BUNDLED_THEMES } from "shiki";
33
import { Logger, Options } from "../../../lib/utils";
44

@@ -54,4 +54,18 @@ describe("Default Options", () => {
5454
throws(() => opts.setValue("markedOptions", []));
5555
});
5656
});
57+
58+
describe("requiredToBeDocumented", () => {
59+
it("Works with valid values", () => {
60+
doesNotThrow(() =>
61+
opts.setValue("requiredToBeDocumented", ["Enum"])
62+
);
63+
});
64+
65+
it("Throws on invalid values", () => {
66+
throws(() =>
67+
opts.setValue("requiredToBeDocumented", ["Enum2" as never])
68+
);
69+
});
70+
});
5771
});

0 commit comments

Comments
 (0)