elk/components/search/types.ts

18 lines
482 B
TypeScript
Raw Normal View History

import type { Account, Status } from 'masto'
2023-01-05 17:48:20 +01:00
import type { RouteLocation } from 'vue-router'
2022-12-17 22:35:07 +01:00
2023-01-05 17:48:20 +01:00
export type BuildResult<K extends keyof any, T> = {
[P in K]: T
} & {
id: string
type: K
to: RouteLocation & {
href: string
2022-12-17 22:35:07 +01:00
}
}
2023-01-05 17:48:20 +01: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