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

Add generic support to vuex hooks #157

Open
Stoom opened this issue Nov 15, 2019 · 1 comment
Open

Add generic support to vuex hooks #157

Stoom opened this issue Nov 15, 2019 · 1 comment

Comments

@Stoom
Copy link

Stoom commented Nov 15, 2019

Hello,

I've recently started to use vue-hooks for vuex. I've noticed that when creating a reactive state variable that expanding out useGetters returns an untyped dictionary. This causes typing issues in TS if you also have regular values as well. It can be overcome by first casting to unknown and then your type. I've noticed this also applies to the other vuex hooks. Would it be possible to support generics on the hooks to reduce the boilerplate?

const state = reactive({
            owner: '',
            ...useGetters(ProfileNS,[
              nameof<ProfileGetters>(x => x.picture),
              nameof<ProfileGetters>(x => x.name),
            ]) as unknown as { picture: string, name: string },
@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.92. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

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

No branches or pull requests

1 participant