typecheck window.NOTABLE_TRAITS

This commit is contained in:
binarycat
2025-08-21 22:42:37 -05:00
parent 4b73a7ec78
commit 6c22ef501e
2 changed files with 2 additions and 2 deletions
-2
View File
@@ -1327,11 +1327,9 @@ function preLoadCss(cssUrl) {
*/
function showTooltip(e) {
const notable_ty = e.getAttribute("data-notable-ty");
// @ts-expect-error
if (!window.NOTABLE_TRAITS && notable_ty) {
const data = document.getElementById("notable-traits-data");
if (data) {
// @ts-expect-error
window.NOTABLE_TRAITS = JSON.parse(data.innerText);
} else {
throw new Error("showTooltip() called with notable without any notable traits!");
+2
View File
@@ -28,6 +28,8 @@ declare global {
currentTheme: HTMLLinkElement|null;
/** Generated in `render/context.rs` */
SIDEBAR_ITEMS?: { [key: string]: string[] };
/** Notable trait data */
NOTABLE_TRAITS?: { [key: string]: string };
/** Used by the popover tooltip code. */
RUSTDOC_TOOLTIP_HOVER_MS: number;
/** Used by the popover tooltip code. */