|
|
@ -1,4 +1,4 @@ |
|
|
|
import Vue, { VNode } from "../index"; |
|
|
|
import Vue, { PropType, VNode } from "../index"; |
|
|
|
import { ComponentOptions, Component } from "../index"; |
|
|
|
import { CreateElement } from "../vue"; |
|
|
|
|
|
|
@ -59,20 +59,36 @@ class Cat { |
|
|
|
private u = 1 |
|
|
|
} |
|
|
|
|
|
|
|
interface IUser { |
|
|
|
foo: string, |
|
|
|
bar: number |
|
|
|
} |
|
|
|
|
|
|
|
interface ICat { |
|
|
|
foo: any, |
|
|
|
bar: object |
|
|
|
} |
|
|
|
|
|
|
|
Vue.component('union-prop', { |
|
|
|
props: { |
|
|
|
primitive: [String, Number], |
|
|
|
cat: Object as PropType<ICat>, |
|
|
|
complexUnion: { type: [User, Number] as PropType<User | number> }, |
|
|
|
kittyUser: Object as PropType<ICat & IUser>, |
|
|
|
mixed: [RegExp, Array], |
|
|
|
object: [Cat, User], |
|
|
|
primitive: [String, Number], |
|
|
|
regex: RegExp, |
|
|
|
mixed: [RegExp, Array], |
|
|
|
union: [User, Number] as {new(): User | Number}[] // requires annotation
|
|
|
|
union: [User, Number] as PropType<User | number> |
|
|
|
}, |
|
|
|
data() { |
|
|
|
this.primitive; |
|
|
|
this.cat; |
|
|
|
this.complexUnion; |
|
|
|
this.kittyUser; |
|
|
|
this.mixed; |
|
|
|
this.object; |
|
|
|
this.union; |
|
|
|
this.primitive; |
|
|
|
this.regex.compile; |
|
|
|
this.mixed; |
|
|
|
this.union; |
|
|
|
return { |
|
|
|
fixedSize: this.union, |
|
|
|
} |
|
|
|