Wrapper component
<script setup lang="ts">
import InputBase,{ Props as InputBaseProps } from "./InputBase.vue";
interface Props extends InputBaseProps {
label?: string;
labelClassName?: string;
...other props
}
const props = defineProps<Props>();
</script>
<template>
// Wrapper specific stuff that uses the above props
<InputBase v-bind="$attrs" />
</template>
Wrapped component
<script setup lang="ts">
import InputBase,{ Props as InputBaseProps } from "./InputBase.vue";
export interface Props {
name:string;
...other props
}
const props = defineProps<Props>();
</script>
<template>
// InputBase logic
</template>
I want to extract just Wrapper Props out and use it in the wrapper and pass everything down to the base component. How could I go about implementing this so that I get all the prop types in the wrapper but I can still easily extract out the InputBaseProps and give it to the base.
I could do this by removing the extends but then the wrapper looses ts intellisense of the base components props. I've tried destructuring with toRefs but that cause issues.