Is there a way to implement type inference for a component that passes all its props to an img
element?
I attempted the following methods:
defineProps<ImgHTMLAttributes>()
// and
defineProps<HTMLImageElement>()
However, both resulted in the error message:
[plugin:vite:vue] [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type
This is how my component looks like:
<script setup lang="ts">
import type { ImgHTMLAttributes } from 'vue'
defineProps<ImgHTMLAttributes>()
// or defineProps<HTMLImageElement>()
</script>
<template>
<div>
// Some other elements here
<img
v-bind="$attrs"
/>
</div>
</template>