vue-ts-utils
Vue TS Utils
Typescript utils for vue2 and Vue3
Installation
npm install vue-ts-utils -D
Features
Inferring Attrs
- Option Component
const Comp = defineComponent({
slots: Object as SlotsType<{
foo?: { data: string }
}>,
attrs: Object as AttrsType<{
bar?: string
}>,
setup(props, { slots, attrs }) {
console.log(attrs.bar)
slots.foo?.({ data: 'a' })
}
});
<Comp bar={"str"} />;
- Functional Component
const Comp = defineComponent(
(props: { foo: string }, ctx) => {
console.log(ctx.attrs.bar)
return () => (
<div>{props.foo}</div>
)
},
{
slots: Object as SlotsType<{
baz?: { data: string }
}>,
attrs: Object as AttrsType<{
bar?: number
}>
}
);
<Comp bar={1} foo={"str"} />;
License
Related Packages
markdown-to-jsx
A very fast and versatile markdown toolchain. AST, React, React Native, SolidJS,...
214,042,213
2,394
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.2.3 | 3.3.4 || | MIT | |
| 0.2.2 | 3.3.4 | MIT | |
| 0.2.1 | 3.3.4 | MIT | |
| 0.2.0 | 3.3.4 | MIT | |
| 0.1.2 | 3.2.45 | MIT | |
| 0.1.1 | 3.2.45 | MIT | |
| 0.1.0 | 3.2.45 | MIT | |
| 0.0.5 | 3.2.45 | MIT | |
| 0.0.4 | 3.2.45 | MIT | |
| 0.0.3 | 3.2.45 | MIT | |
| 0.0.2 | 3.2.45 | MIT | |
| 0.0.1 | 3.2.45 | MIT |
Pre-releases (12)
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.0-beta.5 | 3.3.4 | MIT | |
| 1.0.0-beta.4 | 3.3.4 | MIT | |
| 1.0.0-beta.3 | 3.3.4 | MIT | |
| 1.0.0-beta.2 | 3.3.4 | MIT | |
| 1.0.0-beta.1 | 3.3.4 | MIT | |
| 1.0.0-beta.0 | 3.3.4 | MIT | |
| 0.2.1-beta.5 | 3.3.4 | MIT | |
| 0.2.1-beta.4 | 3.3.4 | MIT | |
| 0.2.1-beta.3 | 3.3.4 | MIT | |
| 0.2.1-beta.2 | 3.3.4 | MIT | |
| 0.2.1-beta.1 | 3.3.4 | MIT | |
| 0.2.1-beta.0 | 3.3.4 | MIT |