elk/components/search/types.ts

18 lines
487 B
TypeScript
Raw Normal View History

2023-01-07 14:21:48 +00:00
import type { Account, Status, Tag } 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-07 14:21:48 +00:00
export type HashTagResult = BuildResult<'hashtag', Tag>
2023-01-05 16:48:20 +00:00
export type AccountResult = BuildResult<'account', Account>
export type StatusResult = BuildResult<'status', Status>
export type SearchResult = HashTagResult | AccountResult | StatusResult