Skip to content

Commit c27af6b

Browse files
committed
Add TypeScript type for window.ALL_CRATES.
1 parent efcbb94 commit c27af6b

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/librustdoc/html/static/js/main.js

-2
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,6 @@ function preLoadCss(cssUrl) {
995995
}
996996

997997
function addSidebarCrates() {
998-
// @ts-expect-error
999998
if (!window.ALL_CRATES) {
1000999
return;
10011000
}
@@ -1009,7 +1008,6 @@ function preLoadCss(cssUrl) {
10091008
const ul = document.createElement("ul");
10101009
ul.className = "block crate";
10111010

1012-
// @ts-expect-error
10131011
for (const crate of window.ALL_CRATES) {
10141012
const link = document.createElement("a");
10151013
link.href = window.rootPath + crate + "/index.html";

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ declare global {
1313
interface Window {
1414
/** Make the current theme easy to find */
1515
currentTheme: HTMLLinkElement|null;
16-
/** Generated in `render/context.rs` */
17-
SIDEBAR_ITEMS?: { [key: string]: string[] };
16+
/** List of all documented crates. */
17+
ALL_CRATES: string[]|undefined;
1818
/** Used by the popover tooltip code. */
1919
RUSTDOC_TOOLTIP_HOVER_MS: number;
2020
/** Used by the popover tooltip code. */

0 commit comments

Comments
 (0)