Skip to content

Commit

Permalink
doc(type-helpers): readme
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Apr 11, 2023
1 parent f1afe50 commit 9a3059a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/vue-component-type-helpers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# vue-component-type-helpers

Some very simple type helpers used behind `vue-component-meta` for extract component props, slots, emit, exposed types.

## Usage

```vue
<template>
<slot name="header" :num="123" />
<slot name="footer" str="abc" />
</template>
<script lang="ts" setup>
defineProps<{
msg: string
}>()
</script>
```

```ts
import HelloWorld from './HelloWorld.vue'
import { ComponentProps, ComponentSlots } from 'vue-component-type-helpers'

type Props = ComponentProps<typeof HelloWorld> // { msg: string }
type Slots = ComponentSlots<typeof HelloWorld> // { header(_: { num: number; }): any; footer(_: { str: string; }): any; }
```

0 comments on commit 9a3059a

Please sign in to comment.