diff --git a/types/options.d.ts b/types/options.d.ts index cc58affe6a1..25eb8a0fdf3 100644 --- a/types/options.d.ts +++ b/types/options.d.ts @@ -133,7 +133,7 @@ export type PropValidator = PropOptions | Prop | Prop[]; export interface PropOptions { type?: Prop | Prop[]; required?: boolean; - default?: T | null | undefined | (() => object); + default?: T | null | undefined | (() => T | null | undefined); validator?(value: T): boolean; } diff --git a/types/test/options-test.ts b/types/test/options-test.ts index 6fc9e356451..17a54fd360b 100644 --- a/types/test/options-test.ts +++ b/types/test/options-test.ts @@ -79,6 +79,18 @@ Vue.component('union-prop', { } }); +Vue.component('prop-with-primitive-default', { + props: { + id: { + type: String, + default: () => String(Math.round(Math.random() * 10000000)) + } + }, + created() { + this.id; + } +}); + Vue.component('component', { data() { this.$mount