]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
refactor(types): set gereric for state (#915)
authorheart <15258394445@163.com>
Wed, 26 Jan 2022 10:03:21 +0000 (18:03 +0800)
committerGitHub <noreply@github.com>
Wed, 26 Jan 2022 10:03:21 +0000 (11:03 +0100)
packages/pinia/src/createPinia.ts

index acd9761243a5f2cc01fef85ebd2c45f48b48f846..a5970994c874c111e45a9203b30ff9c8de031efc 100644 (file)
@@ -1,5 +1,5 @@
 import { Pinia, PiniaPlugin, setActivePinia, piniaSymbol } from './rootStore'
-import { ref, App, markRaw, effectScope, isVue2 } from 'vue-demi'
+import { ref, App, markRaw, effectScope, isVue2, Ref } from 'vue-demi'
 import { registerPiniaDevtools, devtoolsPlugin } from './devtools'
 import { IS_CLIENT } from './env'
 import { StateTree, StoreGeneric } from './types'
@@ -11,7 +11,9 @@ export function createPinia(): Pinia {
   const scope = effectScope(true)
   // NOTE: here we could check the window object for a state and directly set it
   // if there is anything like it with Vue 3 SSR
-  const state = scope.run(() => ref<Record<string, StateTree>>({}))!
+  const state = scope.run<Ref<Record<string, StateTree>>>(() =>
+    ref<Record<string, StateTree>>({})
+  )!
 
   let _p: Pinia['_p'] = []
   // plugins added before calling app.use(pinia)