From: Eduardo San Martin Morote Date: Fri, 9 Jul 2021 16:46:50 +0000 (+0200) Subject: build: fix types X-Git-Tag: v2.0.0-rc.0~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=807069ab0839d64217264eba153b4d6668a62ccd;p=thirdparty%2Fvuejs%2Fpinia.git build: fix types --- diff --git a/src/store.ts b/src/store.ts index 4a21dfcb..43c53dd6 100644 --- a/src/store.ts +++ b/src/store.ts @@ -1,7 +1,6 @@ import { watch, computed, - Ref, inject, getCurrentInstance, reactive, @@ -43,34 +42,6 @@ import { } from './rootStore' import { IS_CLIENT } from './env' -/** - * Create an object of computed properties referring to the root state. This - * allows direct modification of `store.state` while still changing the root - * state. - * - * @param rootStateRef - pinia.state - * @param id - unique name - */ -function computedFromState( - rootStateRef: Ref>, - id: Id -) { - // let asComputed = computed() - const reactiveObject = {} as { - [k in keyof T]: Ref - } - const state = rootStateRef.value[id] - for (const key in state) { - // @ts-expect-error: the key matches - reactiveObject[key] = computed({ - get: () => rootStateRef.value[id][key as keyof T], - set: (value) => (rootStateRef.value[id][key as keyof T] = value), - }) - } - - return reactiveObject -} - function innerPatch( target: T, patchToApply: DeepPartial