Could someone help explain why I am receiving an error from TypeScript that says the following?
error TS7006: Parameter 'el' implicitly has an 'any' type. ref="(el) => saveRef(index, el)"
. I am confident that the correct type is set in the saveRef
function.
<script lang="ts" setup>
import FormComponent from '@/components/FormComponent.vue'
const formRefs = ref<
ComponentPublicInstance<typeof FormComponent>[]
>([])
function saveRef(
index: number,
el: ComponentPublicInstance<typeof FormComponent>
) {
formRefs.value[index] = el
}
onBeforeUpdate(() => {
formRefs.value = []
})
</script>
<template>
<div v-for="(component, index) in components" :key="index">
<form-component
:ref="(el) => saveRef(index, el)"
:component="component"
:index="index"
/>
</div>
</template>