-
Notifications
You must be signed in to change notification settings - Fork 40
/
mixin.tsx
39 lines (34 loc) · 1022 Bytes
/
mixin.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import Vue, { VNode } from "vue";
import * as vuetsx from "vue-tsx-support";
import component from "vue-class-component";
const noop = () => {};
function basicFunctionary() {
const factory = vuetsx.componentFactory.mixin({
props: { foo: String },
computed: {
fooUpper(): string {
return this.foo.toUpperCase();
}
}
}).mixin(vuetsx.component({
props: { bar: String },
computed: {
barUpper(): string {
return this.bar.toUpperCase();
}
}
}, ["bar"])
).mixin(Vue.extend({
data() {
return { baz: "piyo" }
}
}));
const Component = factory.create({
props: { bra: Number },
render(): VNode {
return <div>{ this.fooUpper + this.barUpper + this.baz }</div>
}
});
<Component foo="foo" bar="bar" bra={1} />;
<Component foo="foo" bra={1} />; //// TS2322 | TS2326 | TS2769: Property 'bar' is missing
}