Skip to content

Commit 60c5855

Browse files
committed
ParserQueryElement.typeFilter MAY be a string, OR number.
ideally we would encode that it is a string before convertTypeFilterOnElem is called, and a number after, but i'm not sure that's possible without significant refactoring.
1 parent 2f9ea8a commit 60c5855

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/librustdoc/html/static/js/rustdoc.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ declare namespace rustdoc {
132132
generics: Array<ParserQueryElement>,
133133
bindings: Map<string, Array<ParserQueryElement>>,
134134
bindingName: {name: string|null, generics: ParserQueryElement[]}|null,
135-
typeFilter: string|null,
135+
typeFilter: number|string|null,
136136
}
137137

138138
/**

src/librustdoc/html/static/js/search.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,15 +2319,13 @@ class DocSearch {
23192319
* @param {rustdoc.ParserQueryElement} elem
23202320
*/
23212321
function convertTypeFilterOnElem(elem) {
2322-
if (elem.typeFilter !== null) {
2322+
if (typeof elem.typeFilter === 'string') {
23232323
let typeFilter = elem.typeFilter;
23242324
if (typeFilter === "const") {
23252325
typeFilter = "constant";
23262326
}
2327-
// @ts-expect-error
23282327
elem.typeFilter = itemTypeFromName(typeFilter);
23292328
} else {
2330-
// @ts-expect-error
23312329
elem.typeFilter = NO_TYPE_FILTER;
23322330
}
23332331
for (const elem2 of elem.generics) {

0 commit comments

Comments
 (0)