In react js library is a type that describes the children
– ReactNode
.
Ex:
interface Props {
children: ReactNode;
}
// Define a functional component with the specified props type
const Component = ({ children }: { children: Props) => {
return (
<div>
<p>{children}</p>
</div>
);
};
I did not find a solution to type slots
in vue js. For example i have the next component:
<template>
<div>
<slot/>
</div>
</template>
<script lang="ts" setup>
import { defineProps } from 'vue';
const props = defineProps();
</script>
How to type the slot
to accept a specific type?