From: heart <15258394445@163.com> Date: Wed, 26 Jan 2022 10:03:21 +0000 (+0800) Subject: refactor(types): set gereric for state (#915) X-Git-Tag: pinia@2.0.10~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bfd231b37dd11c208a0013b1c2f2285f856aba16;p=thirdparty%2Fvuejs%2Fpinia.git refactor(types): set gereric for state (#915) --- diff --git a/packages/pinia/src/createPinia.ts b/packages/pinia/src/createPinia.ts index acd97612..a5970994 100644 --- a/packages/pinia/src/createPinia.ts +++ b/packages/pinia/src/createPinia.ts @@ -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>({}))! + const state = scope.run>>(() => + ref>({}) + )! let _p: Pinia['_p'] = [] // plugins added before calling app.use(pinia)