From 68c0d33cd7a848919f75e624e40dbe39be199187 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Mon, 10 Dec 2018 10:25:30 +0800 Subject: [PATCH 1/2] fix(types): avoid `this` in VueConstructor signature https://github.com/vuejs/vue-class-component/issues/294#issuecomment-445526936 --- types/vue.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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)[]; From a96a03552f445a1187f158b79d9c52afe56f698e Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Mon, 10 Dec 2018 14:09:36 +0800 Subject: [PATCH 2/2] fix(types): add test for decorator usage --- types/test/tsconfig.json | 1 + types/test/vue-test.ts | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 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; +}