fix: eliminate all TypeScript any usage across Vue components
Replace 24 `err: any` error handler types with proper `AxiosError<ApiErrorResponse>` typing. Fix additional `as any` casts and `Record<string, any>` patterns in registration field components, event settings, and portal layout. Create shared `ApiErrorResponse` type for portal app. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
import { VForm } from 'vuetify/components/VForm'
|
||||
import { usePersonTagCategories } from '@/composables/api/usePersonTags'
|
||||
import { requiredValidator } from '@core/utils/validators'
|
||||
import type { RegistrationFormField } from '@/types/registration-form-field'
|
||||
import type { RegistrationFormField, RegistrationFormFieldCreateDTO } from '@/types/registration-form-field'
|
||||
import type { RegistrationFieldType } from '@/types/registration-field-template'
|
||||
import { FIELD_TYPE_LABELS, FIELD_TYPES_WITH_OPTIONS } from '@/types/registration-field-template'
|
||||
import type { AxiosError } from 'axios'
|
||||
import type { ApiErrorResponse } from '@/types/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
orgId: string
|
||||
@@ -12,7 +15,7 @@ const props = defineProps<{
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
save: [payload: Record<string, any>]
|
||||
save: [payload: Partial<RegistrationFormFieldCreateDTO>]
|
||||
'update:modelValue': [value: boolean]
|
||||
}>()
|
||||
|
||||
@@ -46,7 +49,7 @@ const dialogTitle = computed(() =>
|
||||
)
|
||||
|
||||
const showOptions = computed(() =>
|
||||
FIELD_TYPES_WITH_OPTIONS.includes(form.value.field_type as any),
|
||||
(FIELD_TYPES_WITH_OPTIONS as readonly string[]).includes(form.value.field_type),
|
||||
)
|
||||
|
||||
const showTagCategory = computed(() => form.value.field_type === 'tag_picker')
|
||||
@@ -87,7 +90,7 @@ function onSubmit() {
|
||||
if (!valid) return
|
||||
|
||||
errors.value = {}
|
||||
const payload: Record<string, any> = {
|
||||
const payload: Partial<RegistrationFormFieldCreateDTO> = {
|
||||
label: form.value.label,
|
||||
is_required: form.value.is_required,
|
||||
is_filterable: form.value.is_filterable,
|
||||
@@ -98,7 +101,7 @@ function onSubmit() {
|
||||
}
|
||||
|
||||
if (!props.field) {
|
||||
payload.field_type = form.value.field_type
|
||||
payload.field_type = form.value.field_type as RegistrationFieldType
|
||||
}
|
||||
|
||||
if (showOptions.value) {
|
||||
@@ -119,8 +122,8 @@ function onSubmit() {
|
||||
})
|
||||
}
|
||||
|
||||
function setErrors(err: any) {
|
||||
const data = err.response?.data
|
||||
function setErrors(err: Error) {
|
||||
const data = (err as AxiosError<ApiErrorResponse>).response?.data
|
||||
if (data?.errors) {
|
||||
errors.value = Object.fromEntries(
|
||||
Object.entries(data.errors).map(([k, v]) => [k, (v as string[])[0]]),
|
||||
|
||||
Reference in New Issue
Block a user