robinvdvleuten / vuex-persistedstate

💾 Persist and rehydrate your Vuex state between page reloads.
https://npm.im/vuex-persistedstate
MIT License
5.77k stars 379 forks source link

Add generic for store state type #267

Closed SanterreJo closed 4 years ago

SanterreJo commented 4 years ago

What:

Fixes #265 As suggested by @robertgr991 Use type inference benefits when using a function like rehydrated

Why:

When implementing a function like rehydrated the store argument is currently typed as any.

How:

By adding a generic type when calling the createPersistedState function

const persisted = createPersistedState<RootState>();

Checklist:

robinvdvleuten commented 4 years ago

@SanterreJo thanks for the effort!

robinvdvleuten commented 4 years ago

@all-contributors please add @SanterreJo for code

allcontributors[bot] commented 4 years ago

@robinvdvleuten

I've put up a pull request to add @SanterreJo! :tada: