From ae1a9a6ee5e813d265ff11a240e5d7f01510f5e6 Mon Sep 17 00:00:00 2001 From: Buster Neece Date: Sun, 19 Jan 2025 00:47:09 -0600 Subject: [PATCH] Minor type fixes. --- .../components/Admin/Backups/ConfigureModal.vue | 2 +- .../components/Common/CodemirrorTextarea.vue | 17 ++++++++++++++--- frontend/functions/useVuelidateOnForm.ts | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/frontend/components/Admin/Backups/ConfigureModal.vue b/frontend/components/Admin/Backups/ConfigureModal.vue index c424db3392..7579dcc9e9 100644 --- a/frontend/components/Admin/Backups/ConfigureModal.vue +++ b/frontend/components/Admin/Backups/ConfigureModal.vue @@ -20,7 +20,7 @@
import CodeMirror from "vue-codemirror6"; -import {useVModel} from "@vueuse/core"; import {computed} from "vue"; import {css} from "@codemirror/lang-css"; import {javascript} from "@codemirror/lang-javascript"; @@ -18,7 +17,7 @@ import {liquidsoap} from "codemirror-lang-liquidsoap"; import useTheme from "~/functions/theme"; const props = defineProps<{ - modelValue: string | null, + modelValue?: string | number | null, mode: string }>(); @@ -26,7 +25,19 @@ const emit = defineEmits<{ (e: 'update:modelValue', modelValue: string | null): void }>(); -const textValue = useVModel(props, 'modelValue', emit); +const textValue = computed({ + get() { + const value = props.modelValue ?? null; + if (value === null) { + return ""; + } + + return String(value); + }, + set(newValue) { + emit('update:modelValue', newValue); + } +}); const lang = computed(() => { switch (props.mode) { diff --git a/frontend/functions/useVuelidateOnForm.ts b/frontend/functions/useVuelidateOnForm.ts index 34d97a0c7d..9be797d013 100644 --- a/frontend/functions/useVuelidateOnForm.ts +++ b/frontend/functions/useVuelidateOnForm.ts @@ -13,7 +13,7 @@ export type VuelidateValidations = Validati export type VuelidateBlankForm = MaybeRef | BlankFormFunc export type VuelidateObject = Validation, T> -export type VuelidateRef = Ref> +export type VuelidateRef = MaybeRef> export function useVuelidateOnForm( validations: VuelidateValidations = {} as VuelidateValidations,