diff --git a/types/options.d.ts b/types/options.d.ts index 3fe7a9b7aaf..f9da73f9ee9 100644 --- a/types/options.d.ts +++ b/types/options.d.ts @@ -144,7 +144,7 @@ export interface RenderContext { injections: any } -export type Prop = { (): T } | { new(...args: any[]): T & object } | { new(...args: string[]): Function } +export type Prop = { (): T extends {}[] ? any[] : T } | { new(...args: any[]): T & object } | { new(...args: string[]): Function } export type PropType = Prop | Prop[]; diff --git a/types/test/options-test.ts b/types/test/options-test.ts index 28060b7c817..a62a02b5987 100644 --- a/types/test/options-test.ts +++ b/types/test/options-test.ts @@ -118,6 +118,25 @@ Vue.component('prop-with-primitive-default', { } }); +// Test issue with the Array prop type +Vue.extend({ + props: { + s: String, + a: {type: Array}, + b: Boolean + }, + created() { + console.log(this.a) + console.log(this.s) + console.log(this.b) + }, + mounted() { + console.log(this.a) + console.log(this.s) + console.log(this.b) + } +}) + Vue.component('component', { data() { this.$mount