Skip to content

Commit bfd231b

Browse files
authored
refactor(types): set gereric for state (#915)
1 parent 8f3af61 commit bfd231b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/pinia/src/createPinia.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Pinia, PiniaPlugin, setActivePinia, piniaSymbol } from './rootStore'
2-
import { ref, App, markRaw, effectScope, isVue2 } from 'vue-demi'
2+
import { ref, App, markRaw, effectScope, isVue2, Ref } from 'vue-demi'
33
import { registerPiniaDevtools, devtoolsPlugin } from './devtools'
44
import { IS_CLIENT } from './env'
55
import { StateTree, StoreGeneric } from './types'
@@ -11,7 +11,9 @@ export function createPinia(): Pinia {
1111
const scope = effectScope(true)
1212
// NOTE: here we could check the window object for a state and directly set it
1313
// if there is anything like it with Vue 3 SSR
14-
const state = scope.run(() => ref<Record<string, StateTree>>({}))!
14+
const state = scope.run<Ref<Record<string, StateTree>>>(() =>
15+
ref<Record<string, StateTree>>({})
16+
)!
1517

1618
let _p: Pinia['_p'] = []
1719
// plugins added before calling app.use(pinia)

0 commit comments

Comments
 (0)