From e06d2af276fc8d626a3b048f4d138a243aa690a4 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com> Date: Tue, 11 Dec 2018 00:53:57 +0800 Subject: [PATCH] fix(types): avoid `this` in VueConstructor signature (#9173) https://github.com/vuejs/vue-class-component/issues/294#issuecomment-445526936 --- types/test/tsconfig.json | 1 + types/test/vue-test.ts | 11 +++++++++-- types/vue.d.ts | 6 +++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/types/test/tsconfig.json b/types/test/tsconfig.json index 15809b5f786..b816ce07cdc 100644 --- a/types/test/tsconfig.json +++ b/types/test/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "target": "es5", + "experimentalDecorators": true, "lib": [ "dom", "es2015" diff --git a/types/test/vue-test.ts b/types/test/vue-test.ts index d9a8379a83f..40ded2d29ce 100644 --- a/types/test/vue-test.ts +++ b/types/test/vue-test.ts @@ -102,10 +102,10 @@ class Test extends Vue { this.compile("
{{ message }}
"); this .use(() => { - + }) .use(() => { - + }) .mixin({}) .mixin({}); @@ -193,3 +193,10 @@ Vue.extend({ return h('canvas', {}, [a]) } }) + +declare function decorate(v: VC): VC; + +@decorate +class Decorated extends Vue { + a = 123; +} diff --git a/types/vue.d.ts b/types/vue.d.ts index 349c3432908..2098a694dec 100644 --- a/types/vue.d.ts +++ b/types/vue.d.ts @@ -111,9 +111,9 @@ export interface VueConstructor { component(id: string, definition: FunctionalComponentOptions>): ExtendedVue; component(id: string, definition?: ComponentOptions): ExtendedVue; - use(plugin: PluginObject | PluginFunction, options?: T): this; - use(plugin: PluginObject | PluginFunction, ...options: any[]): this; - mixin(mixin: VueConstructor | ComponentOptions): this; + use(plugin: PluginObject | PluginFunction, options?: T): VueConstructor; + use(plugin: PluginObject | PluginFunction, ...options: any[]): VueConstructor; + mixin(mixin: VueConstructor | ComponentOptions): VueConstructor; compile(template: string): { render(createElement: typeof Vue.prototype.$createElement): VNode; staticRenderFns: (() => VNode)[];