diff --git a/web/components/Layout.tsx b/web/components/Layout.tsx index b6959b0031..31891fd666 100644 --- a/web/components/Layout.tsx +++ b/web/components/Layout.tsx @@ -51,7 +51,6 @@ export default function Layout({ children, searchIndex }: LayoutProps) {
diff --git a/web/components/Search.tsx b/web/components/Search.tsx index 8313fccf3d..8cf16f9a6c 100644 --- a/web/components/Search.tsx +++ b/web/components/Search.tsx @@ -1,4 +1,4 @@ -import Fuse from 'fuse.js' +import Fuse, { FuseResult } from 'fuse.js' import React, { Fragment, useCallback, useEffect, useState } from 'react' import { Search as SearchIcon } from 'react-feather' import { SearchItem } from '../utils/search' @@ -10,7 +10,7 @@ export interface SearchProps { } interface SearchResultProps { - result: Fuse.FuseResult + result: FuseResult selected: boolean active: boolean } @@ -60,9 +60,9 @@ const SearchResult: React.FunctionComponent = (props) => { const Search: React.FunctionComponent = ({ fuse }) => { const router = useRouter() const [searchText, setSearchText] = useState('') - const [searchResults, setSearchResults] = useState< - Fuse.FuseResult[] - >([]) + const [searchResults, setSearchResults] = useState[]>( + [] + ) const [isOpen, setIsOpen] = useState(false) const handleKeyPress = useCallback( @@ -94,7 +94,7 @@ const Search: React.FunctionComponent = ({ fuse }) => { const searchResult = fuse.search(value) setSearchResults(searchResult) } - const onChange = (value?: Fuse.FuseResult) => { + const onChange = (value?: FuseResult) => { if (value) { if (value.item.kind === 'var') { router.push(`/variables#${value.item.name}`, undefined, { diff --git a/web/utils/search.ts b/web/utils/search.ts index 2f50522350..785bcb6815 100644 --- a/web/utils/search.ts +++ b/web/utils/search.ts @@ -1,4 +1,4 @@ -import Fuse from 'fuse.js' +import Fuse, { FuseIndexRecords } from 'fuse.js' import { getConfigSettings, getLua, getVariables } from './doc-utils' export interface SearchItem { kind: string @@ -8,7 +8,7 @@ export interface SearchItem { export interface SearchIndex { index: { keys: readonly string[] - records: Fuse.FuseIndexRecords + records: FuseIndexRecords } list: SearchItem[] }