elk/components/search/types.ts

18 lines
482 B
TypeScript
Raw Normal View History

import type { Account, Status } from 'masto'
2023-01-05 16:48:20 +00:00
import type { RouteLocation } from 'vue-router'
2022-12-17 21:35:07 +00:00
2023-01-05 16:48:20 +00:00
export type BuildResult<K extends keyof any, T> = {
[P in K]: T
} & {
id: string
type: K
to: RouteLocation & {
href: string
2022-12-17 21:35:07 +00:00
}
}
2023-01-05 16:48:20 +00:00
export type HashTagResult = BuildResult<'hashtag', any>
export type AccountResult = BuildResult<'account', Account>
export type StatusResult = BuildResult<'status', Status>
export type SearchResult = HashTagResult | AccountResult | StatusResult