]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
feat: proper check of computed requiring @vue/composition-api@1.2.3
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 5 Oct 2021 11:11:54 +0000 (13:11 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 5 Oct 2021 11:11:54 +0000 (13:11 +0200)
packages/pinia/package.json
packages/pinia/src/store.ts

index 67269df6d9a3704058459886d2a917d700cba7ec..e9f9dfbb36cb7c8c5851b1aac3d50b1cdd3c4cf3 100644 (file)
@@ -73,7 +73,7 @@
     "vue-demi": "*"
   },
   "peerDependencies": {
-    "@vue/composition-api": "^1.2.2",
+    "@vue/composition-api": "^1.2.3",
     "typescript": "^4.4.3",
     "vue": "^2.6.14 || ^3.2.0"
   },
index 96b8465f07333bc6c69708d442c671ffcc827fa4..ca0b69d4b90480b90b5726ddc8613e81af69a9b2 100644 (file)
@@ -77,15 +77,7 @@ const { assign } = Object
 
 function isComputed<T>(value: ComputedRef<T> | unknown): value is ComputedRef<T>
 function isComputed(o: any): o is ComputedRef {
-  if (isVue2) {
-    const descriptor = o ? Object.getOwnPropertyDescriptor(o, 'value') : null
-    return (descriptor &&
-      descriptor.get &&
-      // TODO: make something in @vue/composition-api to be able to check this
-      descriptor.get.toString().length > 42) as boolean
-  }
-  // !!(isRef(o) && o.effect)
-  return o && o.effect
+  return !!(isRef(o) && (o as any).effect)
 }
 
 function createOptionsStore<