mirror of
https://github.com/gotson/komga.git
synced 2026-05-08 12:35:30 +02:00
fix types
This commit is contained in:
parent
b4cd900c76
commit
d95acc203f
1 changed files with 8 additions and 5 deletions
|
|
@ -6,20 +6,23 @@ export default defineComponent({
|
|||
props: {
|
||||
messageDescriptor: Object as PropType<MessageDescriptor>,
|
||||
tag: String,
|
||||
values: Object,
|
||||
values: Object as PropType<Record<string, string | number | boolean | Date | undefined | null>>,
|
||||
},
|
||||
setup(props, context) {
|
||||
const { messageDescriptor, tag, values = {} } = props
|
||||
if (!messageDescriptor) return () => ''
|
||||
|
||||
const intl = useIntl()
|
||||
const slotNames = Object.keys(context.slots)
|
||||
|
||||
const message = intl.formatMessage(messageDescriptor, {
|
||||
const v = {
|
||||
...values,
|
||||
...slotNames.reduce((slots, name) => {
|
||||
slots[name] = (content) => context.slots[name](() => content)
|
||||
...slotNames.reduce((slots: Record<string, unknown>, name) => {
|
||||
slots[name] = (content: unknown) => context.slots[name]!(() => content)
|
||||
return slots
|
||||
}, {}),
|
||||
})
|
||||
} as Record<string, string | number | boolean | Date | undefined | null>
|
||||
const message = intl.formatMessage(messageDescriptor, v)
|
||||
|
||||
return () => (tag || Array.isArray(message) ? h(tag || 'div', message) : message)
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue