Skip to content

Commit 1a9f56a

Browse files
feat(type): add RootState for store type customization
fix vuejs#994
1 parent 2c1c35b commit 1a9f56a

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"rollup-watch": "^4.3.1",
6767
"selenium-server": "^2.53.1",
6868
"todomvc-app-css": "^2.1.0",
69-
"typescript": "^2.6.1",
69+
"typescript": "^2.8.0-rc",
7070
"uglify-js": "^3.1.2",
7171
"vue": "^2.5.13",
7272
"vue-loader": "^13.3.0",

types/vue.d.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,20 @@ import { Store } from "./index";
77

88
declare module "vue/types/options" {
99
interface ComponentOptions<V extends Vue> {
10-
store?: Store<any>;
10+
store?: Store<PermissiveAny<RootState>>;
1111
}
1212
}
1313

1414
declare module "vue/types/vue" {
1515
interface Vue {
16-
$store: Store<any>;
16+
$store: Store<PermissiveAny<RootState>>;
1717
}
1818
}
19+
20+
export type PermissiveAny<T> = {} extends T ? any : T
21+
22+
// stub for user augmentation
23+
export interface RootState {}
24+
export interface RootActions {}
25+
export interface RootMutations {}
26+
export interface RootGetters {}

0 commit comments

Comments
 (0)