Skip to content

Commit c3ccae0

Browse files
committed
fix: make decorator accepts any vue constructor types (fix #457)
1 parent d723050 commit c3ccae0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Diff for: src/helpers.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919

2020
export function Options<V extends Vue>(
2121
options: ComponentOptions & ThisType<V>
22-
): <VC extends VueConstructor>(target: VC) => VC {
22+
): <VC extends VueConstructor<VueBase>>(target: VC) => VC {
2323
return (Component) => {
2424
Component.__vccBase = options
2525
return Component
@@ -28,19 +28,23 @@ export function Options<V extends Vue>(
2828

2929
export interface VueDecorator {
3030
// Class decorator
31-
(Ctor: VueConstructor): void
31+
(Ctor: VueConstructor<VueBase>): void
3232

3333
// Property decorator
34-
(target: Vue, key: string): void
34+
(target: VueBase, key: string): void
3535

3636
// Parameter decorator
37-
(target: Vue, key: string, index: number): void
37+
(target: VueBase, key: string, index: number): void
3838
}
3939

4040
export function createDecorator(
4141
factory: (options: ComponentOptions, key: string, index: number) => void
4242
): VueDecorator {
43-
return (target: Vue | VueConstructor, key?: any, index?: any) => {
43+
return (
44+
target: VueBase | VueConstructor<VueBase>,
45+
key?: any,
46+
index?: any
47+
) => {
4448
const Ctor =
4549
typeof target === 'function'
4650
? target

0 commit comments

Comments
 (0)