direct-vuex
Advanced tools
Comparing version 0.2.2 to 0.2.3
{ | ||
"name": "direct-vuex", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Just Vuex with typing. Compatible with the Vue 3 composition API.", | ||
@@ -5,0 +5,0 @@ "author": "Paleo", |
@@ -15,8 +15,6 @@ # direct-vuex | ||
The store is implemented in the same way as usual (ie. without typing). | ||
The store is implemented in the same way as usual (ie. without typing). However, it is necessary to append `as const` at the end of store and module implementation objects. It will help direct-vuex to better infer types. | ||
A minor detail anyway: It is necessary to append `as const` at the end of store and module implementation objects. It will help direct-vuex to better infer types. | ||
Create the store: | ||
Then, create the store: | ||
import Vue from "vue" | ||
@@ -23,0 +21,0 @@ import Vuex from "vuex" |
import { Store } from "vuex" | ||
import { ActionsImpl, GettersImpl, ModulesImpl, MutationsImpl, StoreOptions, StoreOrModuleOptions } from "./index" | ||
export interface ToDirectStore<O extends StoreOptions> { | ||
export type ToDirectStore<O extends StoreOptions> = ToFlatStore<{ | ||
original: Store<DirectState<O>>, | ||
@@ -10,3 +10,3 @@ state: DirectState<O> | ||
dispatch: DirectActions<O> | ||
} | ||
}> | ||
@@ -91,2 +91,8 @@ // State | ||
type UnionToIntersection<U> = | ||
(U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never | ||
(U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never | ||
type ToFlatStore<T> = | ||
T extends Store<any> | Function ? T : | ||
T extends object ? | ||
T extends infer O ? { [K in keyof O]: ToFlatStore<O[K]> } : never | ||
: T |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22441
399
71