Skip to content
Snippets Groups Projects
Commit 8e07ad21 authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

fix: fix various type issues

parent c887455e
No related branches found
No related tags found
No related merge requests found
......@@ -154,14 +154,13 @@ defineOptions({
})
defineSlots<{
default(
props: Record<string, unknown> & {
id: string
choice: T
index: number
activeIndex: number
},
): unknown
default(props: {
id: string
choice: T
index: number
activeIndex: number
[k: string]: unknown
}): unknown
selected(props: {
value: null | T | T[]
deselect: (choice: null | T) => void
......
......@@ -8,16 +8,21 @@
input-class="tw-border-none tw-px-1 tw-w-[100px] focus:tw-shadow-none focus:tw-outline-none focus:tw-ring-0"
@search="searchQuery = $event"
>
<template #default="{ choice, ...attributes }">
<slot :choice="choice" v-bind="attributes">
<li v-bind="attributes">
{{ choice.name }}
<template #default="{ choice, ...attrs }">
<slot :choice="choice as T" v-bind="attrs">
<li v-bind="attrs">
{{ (choice as T).name }}
</li>
</slot>
</template>
<template #selected="{ value, deselect, isOpen }">
<slot name="selected" :value="value" :deselect="deselect" :is-open="isOpen">
<slot
name="selected"
:value="value as (T | T[] | null)"
:deselect="deselect"
:is-open="isOpen"
>
<template v-if="Array.isArray(value)">
<Tag
v-for="(item, index) in value"
......@@ -28,7 +33,7 @@
/>
</template>
<template v-else>
<p v-if="value">{{ value.name }}</p>
<p v-if="value">{{ (value as T).name }}</p>
</template>
</slot>
</template>
......
......@@ -62,8 +62,8 @@ import { useI18n } from '@/i18n'
defineOptions({ compatConfig: { MODE: 3 } })
const page = defineModel('page', { required: false })
const itemsPerPage = defineModel('itemsPerPage', { required: false })
const page = defineModel<number>('page', { required: false })
const itemsPerPage = defineModel<number>('itemsPerPage', { required: false })
defineProps<{
items?: T[]
......
......@@ -13,7 +13,7 @@ type Route = {
type BreadcrumbLabel = { title: string }
type BreadcrumbLink = BreadcrumbLabel & ({ route: Route } | { link: string })
export type Breadcrumb = string | BreadcrumbLabel | BreadcrumbLink
export type BreadcrumbNormalized = { title: string; as: string; attrs: unknown }
export type BreadcrumbNormalized = { title: string; as: string; attrs: Record<string, unknown> }
type MenuItem = {
title: string
......
......@@ -7,7 +7,7 @@
>
<template #default="{ choice, ...itemAttrs }">
<li v-bind="itemAttrs">
<UserPreview :user="choice" transparent />
<UserPreview :user="choice as SteeringUser" transparent />
</li>
</template>
<template #selected="{ deselect }">
......@@ -27,6 +27,7 @@ import ComboBoxSimple from '@/components/ComboBoxSimple.vue'
import UserPreview from '@/components/UserPreview.vue'
import { useAuthStore, useShowStore, useUserStore } from '@/stores'
import { useRelationList } from '@/form'
import { SteeringUser } from '@/stores/auth'
const props = defineProps<{
show: Show
......
......@@ -14,13 +14,13 @@
<template #default="{ choice, index, activeIndex, ...attrs }">
<li v-bind="attrs">
<p class="tw-m-0 tw-font-bold tw-flex tw-items-baseline tw-justify-between">
<SafeHTML :html="choice.name" sanitize-preset="strip" />
<SafeHTML :html="(choice as Show).name" sanitize-preset="strip" />
<span class="tw-text-xs tw-opacity-75 tw-flex-none tw-font-normal">
ID: {{ choice.id }}
ID: {{ (choice as Show).id }}
</span>
</p>
<span
v-if="!choice.isActive"
v-if="!(choice as Show).isActive"
class="tw-text-sm tw-rounded-full tw-bg-black/10 tw-text-black/75 tw-px-2 tw-inline-block tw-float-right tw-m-0 tw-ml-1 tw-mb-1"
>
{{ t('showSelector.showState.inactive') }}
......@@ -29,7 +29,7 @@
v-show="activeIndex === index"
as="p"
class="tw-my-1 tw-text-sm tw-opacity-90"
:html="choice.shortDescription"
:html="(choice as Show).shortDescription"
/>
<span class="tw-clear-both" />
</li>
......
......@@ -10,6 +10,7 @@
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"skipLibCheck": true,
"lib": ["esnext", "dom", "DOM.Iterable"],
"types": ["vite/client", "@types/node", "@types/node-polyglot", "@types/web-bluetooth"],
"paths": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment