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

WritableComputed type is lost #2767

Closed
posva opened this issue Sep 6, 2024 · 9 comments
Closed

WritableComputed type is lost #2767

posva opened this issue Sep 6, 2024 · 9 comments
Labels
bug Something isn't working typescript This issue is related to typings

Comments

@posva
Copy link
Member

posva commented Sep 6, 2024

Reproduction

https://play.pinia.vuejs.org/#eNqNVU1v2kAQ/SsjX2wksJumSiUKhKRN1faQVkkuVd2DsQe8wd619sNQIf57x7vYmDSJChd75828N7Mz4513VVVhbdAbexOVSlZpUKhNBUXCV9PY0yr2ZjFnZSWkhh0YhfdaSIQ9LKUowQ+jVBiuUYZa+TGPeSq4oiAWNO3wwSCmY3oIFwmnvyLb25hPIkdKFPSisayKRCO9AUwyVs9+CiOJyDCtYJGoNeox7HbgwofOcG3PYb+fRI1L6wv1iC0pgxPWsEC+0rnNCehnSb6U5RBYkziWCv4IA3lSY8PznC8RkRR3Ap8E9zUUbI2gcywvjxIo9sJoLTjM04Kl66dKKH9fSCoy+qTmDinxFNvAsGFE5MxqErlALrOTHGe3QgNyYVZ569qT8IKAftXCyqg88J2vPyAlV1nWhuoRT6Le3XhDz/XDqEyq8FEJTt2zaxjjg4Gahu7JlSH2KsZZ0pzEXmSfQ1TlaCHFRlHbPBJ42ELn1IpRhrUWolCjpGLOLde6UuMoSjNO+AwLVsuQo454VUb/+MwvwovwLCrYIiKiiPEMt6c05DHKsPyf6C10/iY8exe+t1Hr80PQsonaBN3HfE9l0Yq6f8lWT4qSirJiBcrvlWY0HSfFSYpCbL7ZMy0NdhLTHNP1M+ePautU/5BI5auxl5ZO5Aq1M9/c3+KWnjtjKTJTEPoV4x0qUZhGo4NdG56R7B7Oqv1q75jx1YO62Wrkqk2qEWqrYfG2zB9fSf0o9zw871XxuFCohN3myXDJ+JPlY7uJtk4HkrgcQlNuozHrYKTDribcWpjbUN0mm/ZDB/6B3R9CMIDpzMl1Lif7ZtqQBb/a2RmCn1RVgc3D8egw4b8HH45RjgugFRocSkLVGB9YT4a0TgpDc8sK0hUE1nQEwXRKq6Sd4MNN0Q6nSBw3nxvImBaZpPt6ITIpeYaOZvt1LriElgDGzu7o9y7bdkm2HH6O1D0+RBE83INYNxhJ3xrJ6eL6AoZdiZqGoA+Ht/8LgWlAcw==

Steps to reproduce the bug

  • check store.ts

Expected behavior

No TS error

Actual behavior

writable computed is coerced to a simple getter

Additional information

This might require some Types refactor

@posva posva added bug Something isn't working typescript This issue is related to typings labels Sep 6, 2024
@Bishal99-pj

This comment was marked as spam.

@filipbekic01

This comment was marked as spam.

@eliseevmikhail

This comment was marked as spam.

@posva
Copy link
Member Author

posva commented Sep 30, 2024

Note: different types for the setter and getter cannot be supported until the feature is supported in TS:

@Q16solver
Copy link

Q16solver commented Oct 1, 2024

This doesn't seem to work when the variable ref is extracted via storeToRefs whereas it was fine before (prior to vue 3.5 I believe), is this expected?

@martn001
Copy link

martn001 commented Oct 1, 2024

I can confirm that the bug seems to be solved with the newest pinia version! I am using "vue": "^3.5.9", and "pinia": "^2.2.3",.

@posva
Copy link
Member Author

posva commented Oct 1, 2024

This doesn't seem to work when the variable ref is extracted via storeToRefs whereas it was fine before (prior to vue 3.5 I believe), is this expected?

A fix is on the way

@Q16solver
Copy link

Insane speed, kudos to you my man

@jlmtz
Copy link

jlmtz commented Oct 6, 2024

Works fine but Vue DevTools still coerce WritableComputed to getters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working typescript This issue is related to typings
Projects
Archived in project
Development

No branches or pull requests

7 participants