diff --git a/types/helpers.d.ts b/types/helpers.d.ts index e86650485..c7530151d 100644 --- a/types/helpers.d.ts +++ b/types/helpers.d.ts @@ -5,6 +5,7 @@ type Dictionary = { [key: string]: T }; type Computed = () => any; type MutationMethod = (...args: any[]) => void; type ActionMethod = (...args: any[]) => Promise; +type CustomVue = Vue & Dictionary interface Mapper { (map: string[]): Dictionary; @@ -17,26 +18,26 @@ interface MapperWithNamespace { } interface FunctionMapper { - (map: Dictionary<(this: typeof Vue, fn: F, ...args: any[]) => any>): Dictionary; + (map: Dictionary<(this: CustomVue, fn: F, ...args: any[]) => any>): Dictionary; } interface FunctionMapperWithNamespace { ( namespace: string, - map: Dictionary<(this: typeof Vue, fn: F, ...args: any[]) => any> + map: Dictionary<(this: CustomVue, fn: F, ...args: any[]) => any> ): Dictionary; } interface MapperForState { ( - map: Dictionary<(this: typeof Vue, state: S, getters: any) => any> + map: Dictionary<(this: CustomVue, state: S, getters: any) => any> ): Dictionary; } interface MapperForStateWithNamespace { ( namespace: string, - map: Dictionary<(this: typeof Vue, state: S, getters: any) => any> + map: Dictionary<(this: CustomVue, state: S, getters: any) => any> ): Dictionary; } diff --git a/types/test/helpers.ts b/types/test/helpers.ts index 460b692a4..569a9ecaf 100644 --- a/types/test/helpers.ts +++ b/types/test/helpers.ts @@ -41,7 +41,10 @@ new Vue({ k: "k" }), helpers.mapState({ - k: (state: any, getters: any) => state.k + getters.k + k: (state: any, getters: any) => state.k + getters.k, + useThis(state: any, getters: any) { + return state.k + getters.k + this.whatever + } }), helpers.mapGetters(["l"]),