Skip to content

Commit 3601b26

Browse files
committed
validate group boosts
1 parent 54abe77 commit 3601b26

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
7979
name: "searchGroupBoosts",
8080
help: 'Configure search to give a relevance boost to selected kinds (eg "class")',
8181
type: ParameterType.Mixed,
82+
validate(value: unknown) {
83+
const validValues = Object.values(ReflectionKind)
84+
.filter((v) => typeof v === "string")
85+
.map((v) => v.toString().toLowerCase());
86+
87+
for (const kindName in value as { [key: string]: number }) {
88+
if (validValues.indexOf(kindName) < 0) {
89+
throw new Error(
90+
`'${kindName}' is an invalid value for 'searchGroupBoosts'. Must be one of: ${validValues.join(
91+
", "
92+
)}`
93+
);
94+
}
95+
}
96+
},
8297
});
8398
options.addDeclaration({
8499
name: "disableSources",

0 commit comments

Comments
 (0)