@azee/vue-component-type-helpers
v3.0.9
Published
Some very simple type helpers used behind `@azee/vue-component-meta` for extract component props, slots, emit, exposed types.
Readme
@azee/vue-component-type-helpers
Some very simple type helpers used behind @azee/vue-component-meta for extract component props, slots, emit, exposed types.
Usage
<template>
<slot name="header" :num="123" />
<slot name="footer" str="abc" />
</template>
<script lang="ts" setup>
defineProps<{
msg: string;
}>();
</script>import HelloWorld from './HelloWorld.vue';
import type { ComponentProps, ComponentSlots } from '@azee/vue-component-type-helpers';
type Props = ComponentProps<typeof HelloWorld>; // { msg: string }
type Slots = ComponentSlots<typeof HelloWorld>; // { header?: (props: { num: number; }) => any; footer?: (props: { str: string; }) => any; }