Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rudyxu1102 authored Sep 30, 2023
1 parent 8a1a5dd commit 197fb35
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ npm install vue-ts-utils -D
### Inferring Attrs
### 1. Wrapping a html element
```tsx
import { defineComponent, type ImgHTMLAttributes, type AttrsType } from 'vue';

import { defineComponent, type AttrsType } from 'vue-ts-utils';
import { type ImgHTMLAttributes } from 'vue';
const MyImg = defineComponent({
props: {
foo: String
Expand All @@ -30,7 +30,7 @@ const MyImg = defineComponent({

### 2. Wrapping a component
```tsx
import { defineComponent, type AttrsType } from 'vue';
import { defineComponent, type AttrsType } from 'vue-ts-utils';

const Child = defineComponent({
props: {
Expand Down Expand Up @@ -62,6 +62,23 @@ const Comp = defineComponent({
val; // number
}} />;
```
### Inferring Inject
```tsx
import { defineComponent } from 'vue-ts-utils';

const Child = defineComponent({
props: {
foo: String
},
inject: ['bar'],
created() {
this.bar; // unknown
},
render() {
return <div>{this.foo}</div>
}
});


## License

Expand Down

0 comments on commit 197fb35

Please sign in to comment.