export type _ExtractStateFromSetupStore<SS> = SS extends undefined | void
? {}
: _ExtractStateFromSetupStore_Keys<SS> extends keyof SS
- ? _UnwrapAll<Pick<SS, _ExtractStateFromSetupStore_Keys<SS>>>
+ ? Pick<SS, _ExtractStateFromSetupStore_Keys<SS>>
: never
/**
-import { computed, ref, shallowRef } from 'vue'
+import { computed, Ref, ref, shallowRef } from 'vue'
import { defineStore, expectType } from './'
const name = ref('Eduardo')
counter,
aRef: ref(0),
aShallowRef: shallowRef({ msg: 'hi' }),
+ anotherShallowRef: shallowRef({ aRef: ref('hello') }),
}),
getters: {
expectType<{ msg: string }>(store.aShallowRef)
expectType<{ msg: string }>(store.$state.aShallowRef)
+expectType<{ aRef: Ref<string> }>(store.anotherShallowRef)
+expectType<{ aRef: Ref<string> }>(store.$state.anotherShallowRef)
const onlyState = defineStore({
id: 'main',
expectType<string>(state.some)
expectType<string>(state.name)
})
+
+const useSetupStore = defineStore('composition', () => ({
+ anotherShallowRef: shallowRef({ aRef: ref('hello') }),
+}))
+
+const setupStore = useSetupStore()
+expectType<{ aRef: Ref<string> }>(setupStore.anotherShallowRef)
+expectType<{ aRef: Ref<string> }>(setupStore.$state.anotherShallowRef)