]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
build: fix types
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 9 Jul 2021 16:46:50 +0000 (18:46 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 19 Jul 2021 09:51:12 +0000 (11:51 +0200)
src/store.ts

index 4a21dfcb419ef732211c2ee3d5f0b28f9f93f75c..43c53dd650be5e0fe3a72b409f5e03a6f4bd494a 100644 (file)
@@ -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<T, Id extends string>(
-  rootStateRef: Ref<Record<Id, T>>,
-  id: Id
-) {
-  // let asComputed = computed<T>()
-  const reactiveObject = {} as {
-    [k in keyof T]: Ref<T[k]>
-  }
-  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<T extends StateTree>(
   target: T,
   patchToApply: DeepPartial<T>