direct-vuex
Advanced tools
Comparing version 0.11.1 to 0.12.0
{ | ||
"name": "direct-vuex", | ||
"version": "0.11.1", | ||
"version": "0.12.0", | ||
"description": "Use and implement your Vuex store with TypeScript types. Compatible with the Vue 3 composition API.", | ||
@@ -5,0 +5,0 @@ "author": "Paleo", |
@@ -38,6 +38,6 @@ import { ActionContext, Store } from "vuex" | ||
type GetStateInModules<I extends ModulesImpl> = { | ||
[M in keyof I]: DirectState<I[M]> | ||
readonly [M in keyof I]: DirectState<I[M]> | ||
} | ||
type ToStateObj<T> = T extends (() => any) ? ReturnType<T> : T | ||
type ToStateObj<T> = T extends (() => any) ? Readonly<ReturnType<T>> : Readonly<T> | ||
@@ -54,9 +54,14 @@ // Getters | ||
type GetGettersInModules<I extends ModulesImpl> = { | ||
[M in keyof I]: DirectGetters<I[M]> | ||
readonly [M in keyof I]: DirectGetters<I[M]> | ||
} | ||
type ToDirectGetters<T extends GettersImpl> = { | ||
[K in keyof T]: ReturnType<T[K]> | ||
readonly [K in keyof T]: ReadonlyReturnTypeExceptCb<T[K]> | ||
} | ||
type ReadonlyReturnTypeExceptCb<T extends (...args: any) => any> = | ||
T extends ((...args1: any) => (...args2: any) => any) | ||
? ReturnType<T> | ||
: Readonly<ReturnType<T>> | ||
type MergeGettersFromModules<I extends ModulesImpl> = | ||
@@ -77,7 +82,7 @@ UnionToIntersection<ToDirectGetters<OrEmpty<I[keyof I]["getters"]>>> | ||
type ToDirectMutations<T extends MutationsImpl> = { | ||
[K in keyof T]: Parameters<T[K]>[1] extends undefined | ||
? (() => void) | ||
: (Extract<Parameters<T[K]>[1], undefined> extends never ? | ||
((payload: Parameters<T[K]>[1]) => void) : | ||
((payload?: Parameters<T[K]>[1]) => void)) | ||
[K in keyof T]: Parameters<T[K]>[1] extends undefined | ||
? (() => void) | ||
: (Extract<Parameters<T[K]>[1], undefined> extends never ? | ||
((payload: Parameters<T[K]>[1]) => void) : | ||
((payload?: Parameters<T[K]>[1]) => void)) | ||
} | ||
@@ -100,7 +105,7 @@ | ||
type ToDirectActions<T extends ActionsImpl> = { | ||
[K in keyof T]: Parameters<T[K]>[1] extends undefined | ||
? (() => PromiseOf<ReturnType<T[K]>>) | ||
: (Extract<Parameters<T[K]>[1], undefined> extends never ? | ||
((payload: Parameters<T[K]>[1]) => PromiseOf<ReturnType<T[K]>>) : | ||
((payload?: Parameters<T[K]>[1]) => PromiseOf<ReturnType<T[K]>>)) | ||
[K in keyof T]: Parameters<T[K]>[1] extends undefined | ||
? (() => PromiseOf<ReturnType<T[K]>>) | ||
: (Extract<Parameters<T[K]>[1], undefined> extends never ? | ||
((payload: Parameters<T[K]>[1]) => PromiseOf<ReturnType<T[K]>>) : | ||
((payload?: Parameters<T[K]>[1]) => PromiseOf<ReturnType<T[K]>>)) | ||
} | ||
@@ -107,0 +112,0 @@ |
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
63238
10
796