From 1fa8246e2a006561fedfba9c7202bbb8946dcdc9 Mon Sep 17 00:00:00 2001 From: Amir Pourmand Date: Thu, 18 Sep 2025 01:55:44 +0330 Subject: [PATCH] refactor(search): update search results type to DefaultDocumentSearchResults - Imported DefaultDocumentSearchResults from FlexSearch for improved type safety. - Changed the type of searchResults from 'any' to DefaultDocumentSearchResults for better clarity and maintainability. --- quartz/components/scripts/search.inline.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quartz/components/scripts/search.inline.ts b/quartz/components/scripts/search.inline.ts index 69037118d..6a84a50e0 100644 --- a/quartz/components/scripts/search.inline.ts +++ b/quartz/components/scripts/search.inline.ts @@ -1,4 +1,4 @@ -import FlexSearch from "flexsearch" +import FlexSearch, { DefaultDocumentSearchResults } from "flexsearch" import { ContentDetails } from "../../plugins/emitters/contentIndex" import { registerEscapeHandler, removeAllChildren } from "./util" import { FullSlug, normalizeRelativeURLs, resolveRelative } from "../../util/path" @@ -403,7 +403,7 @@ async function setupSearch(searchElement: Element, currentSlug: FullSlug, data: searchLayout.classList.toggle("display-results", currentSearchTerm !== "") searchType = currentSearchTerm.startsWith("#") ? "tags" : "basic" - let searchResults: any[] + let searchResults: DefaultDocumentSearchResults if (searchType === "tags") { currentSearchTerm = currentSearchTerm.substring(1).trim() const separatorIndex = currentSearchTerm.indexOf(" ")