TypeScript shows incorrect ref type for setup store properties instead of auto-unwrapped type #3026
-
Reproductionhttps://pinia.vuejs.org/core-concepts/#Using-the-store Steps to reproduce the bug
Expected behavior
Actual behavior
Additional informationEnvironment:
Minimal reproduction: // stores/chat.ts
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
export const useChatStore = defineStore('chat', () => {
const count = ref(0)
const name = ref('Eduardo')
const doubleCount = computed(() => count.value * 2)
function increment() {
count.value++
}
return {
count,
name,
doubleCount,
increment,
}
})
<!-- pages/c/[[id]].vue -->
<script setup>
import { useChatStore } from '~/stores/chat'
const chatStore = useChatStore()
// TypeScript shows: { value: number; [RefSymbol]: true }
// Runtime shows: 0 (number)
console.log("chatStore.count ===>", chatStore.count)
</script> Additional context
|
Beta Was this translation helpful? Give feedback.
Answered by
posva
Aug 26, 2025
Replies: 1 comment
-
This was fixed in newer version, upgrade your versions. Don't open issues that do not follow the guidelines, thank you. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
posva
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was fixed in newer version, upgrade your versions.
Don't open issues that do not follow the guidelines, thank you.