Skip to content

Commit 8be59b4

Browse files
committed
update types for new helper signatures
1 parent 774c4d7 commit 8be59b4

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

types/helpers.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,30 @@ import Vue = require("vue");
33
type Dictionary<T> = { [key: string]: T };
44

55
export function mapState (map: string[]): Dictionary<() => any>;
6+
export function mapState (namespace: string, map: string[]): Dictionary<() => any>;
67
export function mapState (map: Dictionary<string>): Dictionary<() => any>;
8+
export function mapState (namespace: string, map: Dictionary<string>): Dictionary<() => any>;
79
export function mapState <S>(
810
map: Dictionary<(this: typeof Vue, state: S, getters: any) => any>
911
): Dictionary<() => any>;
12+
export function mapState <S>(
13+
namespace: string,
14+
map: Dictionary<(this: typeof Vue, state: S, getters: any) => any>
15+
): Dictionary<() => any>;
1016

1117
type MutationMethod = (...args: any[]) => void;
1218
export function mapMutations (map: string[]): Dictionary<MutationMethod>;
19+
export function mapMutations (namespace: string, map: string[]): Dictionary<MutationMethod>;
1320
export function mapMutations (map: Dictionary<string>): Dictionary<MutationMethod>;
21+
export function mapMutations (namespace: string, map: Dictionary<string>): Dictionary<MutationMethod>;
1422

1523
export function mapGetters (map: string[]): Dictionary<() => any>;
24+
export function mapGetters (namespace: string, map: string[]): Dictionary<() => any>;
1625
export function mapGetters (map: Dictionary<string>): Dictionary<() => any>;
26+
export function mapGetters (namespace: string, map: Dictionary<string>): Dictionary<() => any>;
1727

1828
type ActionMethod = (...args: any[]) => Promise<any[]>;
1929
export function mapActions (map: string[]): Dictionary<ActionMethod>;
30+
export function mapActions (namespace: string, map: string[]): Dictionary<ActionMethod>;
2031
export function mapActions (map: Dictionary<string>): Dictionary<ActionMethod>;
32+
export function mapActions (namespace: string, map: Dictionary<string>): Dictionary<ActionMethod>;

types/test/helpers.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,28 @@ import {
1010
new Vue({
1111
computed: Object.assign({},
1212
mapState(["a"]),
13+
mapState('foo', ["a"]),
1314
mapState({
1415
b: "b"
1516
}),
17+
mapState('foo', {
18+
b: "b"
19+
}),
1620
mapState({
1721
c: (state: any, getters: any) => state.c + getters.c
1822
}),
23+
mapState('foo', {
24+
c: (state: any, getters: any) => state.c + getters.c
25+
}),
1926

2027
mapGetters(["d"]),
28+
mapGetters('foo', ["d"]),
2129
mapGetters({
2230
e: "e"
2331
}),
32+
mapGetters('foo', {
33+
e: "e"
34+
}),
2435

2536
{
2637
otherComputed () {
@@ -34,11 +45,19 @@ new Vue({
3445
mapActions({
3546
h: "h"
3647
}),
48+
mapActions('foo', ["g"]),
49+
mapActions('foo', {
50+
h: "h"
51+
}),
3752

3853
mapMutations(["i"]),
3954
mapMutations({
4055
j: "j"
4156
}),
57+
mapMutations('foo', ["i"]),
58+
mapMutations('foo', {
59+
j: "j"
60+
}),
4261

4362
{
4463
otherMethod () {}

0 commit comments

Comments
 (0)