Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storeToRefs returns any type for Ref<any> #933

Closed
axelthat opened this issue Dec 30, 2021 · 1 comment
Closed

storeToRefs returns any type for Ref<any> #933

axelthat opened this issue Dec 30, 2021 · 1 comment

Comments

@axelthat
Copy link

Steps to reproduce the behavior

  1. Create usePiniaStore.ts,
export const usePiniaStore = defineStore("piniaStore", () => {
  const error = ref<any>(null)

  return {
    error,
  }
})
  1. Finally use storeToRefs,
const { error } = storeToRefs(usePiniaStore())

You will see error has an any type instead of Ref<any>.

Screen Shot 2021-12-30 at 6 27 04 PM

Expected behavior

I expect error to be Ref<any> instead of just any.

Actual behavior

Returns any instead of Ref<any>.

Additional information

Here is my package.json,

{
  "name": "vue-3",
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vue-tsc --noEmit && vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "pinia": "^2.0.9",
    "vue": "^3.2.25"
  },
  "devDependencies": {
    "@types/node": "^17.0.5",
    "@vitejs/plugin-vue": "^2.0.0",
    "typescript": "^4.4.4",
    "vite": "^2.7.2",
    "vue-tsc": "^0.29.8"
  }
}
@axelthat
Copy link
Author

axelthat commented Dec 30, 2021

It happens on vue js as well so I have created a new issue there as well: vuejs/core#5188.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant