Skip to content

Commit

Permalink
feat(type): add RootState for store type customization
Browse files Browse the repository at this point in the history
  • Loading branch information
HerringtonDarkholme committed Mar 16, 2018
1 parent 2c1c35b commit 1a9f56a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -66,7 +66,7 @@
"rollup-watch": "^4.3.1",
"selenium-server": "^2.53.1",
"todomvc-app-css": "^2.1.0",
"typescript": "^2.6.1",
"typescript": "^2.8.0-rc",
"uglify-js": "^3.1.2",
"vue": "^2.5.13",
"vue-loader": "^13.3.0",
Expand Down
12 changes: 10 additions & 2 deletions types/vue.d.ts
Expand Up @@ -7,12 +7,20 @@ import { Store } from "./index";

declare module "vue/types/options" {
interface ComponentOptions<V extends Vue> {
store?: Store<any>;
store?: Store<PermissiveAny<RootState>>;
}
}

declare module "vue/types/vue" {
interface Vue {
$store: Store<any>;
$store: Store<PermissiveAny<RootState>>;
}
}

export type PermissiveAny<T> = {} extends T ? any : T

// stub for user augmentation
export interface RootState {}
export interface RootActions {}
export interface RootMutations {}
export interface RootGetters {}

0 comments on commit 1a9f56a

Please sign in to comment.