chore(CommandPalette): improve fuse.js import types .ts file

This commit is contained in:
Benjamin Canac
2024-07-23 14:17:58 +02:00
parent 8c531615ef
commit fcf46d7171
2 changed files with 4 additions and 4 deletions

View File

@@ -74,7 +74,7 @@ import { computed, defineComponent } from 'vue'
import type { PropType } from 'vue' import type { PropType } from 'vue'
import { ComboboxOption as HComboboxOption, provideUseId } from '@headlessui/vue' import { ComboboxOption as HComboboxOption, provideUseId } from '@headlessui/vue'
import { UIcon, UAvatar, UKbd } from '#components' import { UIcon, UAvatar, UKbd } from '#components'
import type { Group } from '../../types' import type { Command, Group } from '../../types'
import { commandPalette } from '#ui/ui.config' import { commandPalette } from '#ui/ui.config'
import { useId } from '#imports' import { useId } from '#imports'
@@ -118,7 +118,7 @@ export default defineComponent({
return typeof label === 'function' ? label(props.query) : label return typeof label === 'function' ? label(props.query) : label
}) })
function highlight (text: string, { indices, value }: { indices: number[][], value: string }): string { function highlight (text: string, { indices, value }: Command['matches'][number]): string {
if (text === value) { if (text === value) {
return '' return ''
} }

View File

@@ -1,4 +1,4 @@
import type { FuseSortFunctionMatch, FuseSortFunctionMatchList } from 'fuse.js' import Fuse from 'fuse.js'
import type { Avatar } from './avatar' import type { Avatar } from './avatar'
export interface Command { export interface Command {
@@ -13,7 +13,7 @@ export interface Command {
shortcuts?: string[] shortcuts?: string[]
group?: string group?: string
score?: number score?: number
matches?: (FuseSortFunctionMatch | FuseSortFunctionMatchList)[] matches?: Fuse.FuseResultMatch[]
[key: string]: any [key: string]: any
} }