diff --git a/types/options.d.ts b/types/options.d.ts index f49ca085e4e..0601e5613cf 100644 --- a/types/options.d.ts +++ b/types/options.d.ts @@ -61,7 +61,7 @@ export type ThisTypedComponentOptionsWithRecordProps>>; type DefaultData = object | ((this: V) => object); -type DefaultProps = Record; +type DefaultProps = {}; type DefaultMethods = { [key: string]: (this: V, ...args: any[]) => any }; type DefaultComputed = { [key: string]: any }; export interface ComponentOptions< diff --git a/types/test/options-test.ts b/types/test/options-test.ts index fb06abb583b..d6cf778faec 100644 --- a/types/test/options-test.ts +++ b/types/test/options-test.ts @@ -105,6 +105,34 @@ Vue.component('union-prop-with-no-casting', { } }) +Vue.component('union-prop-with-no-casting-and-computed-return-this', { + props: { + mixed: [RegExp, Array], + object: [Cat, User], + primitive: [String, Number], + regex: RegExp + }, + data() { + this.mixed; + this.object; + this.primitive; + this.regex.compile; + }, + computed: { + returnThis () { + this + return this.mixed + } + }, + methods: { + hello() { + console.log(this.mixed); + console.log(this.returnThis) + return 0 + } + }, +}) + Vue.component('prop-with-primitive-default', { props: { id: {