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

Unable to override types/vue.d.ts #1485

Closed
mrkstwrt opened this issue Jan 15, 2019 · 1 comment
Closed

Unable to override types/vue.d.ts #1485

mrkstwrt opened this issue Jan 15, 2019 · 1 comment

Comments

@mrkstwrt
Copy link

mrkstwrt commented Jan 15, 2019

Version

3.0.1

Reproduction link

https://github.com/vuejs/vuex/blob/dev/types/vue.d.ts

Steps to reproduce

types/vue.d.ts contains the following

declare module "vue/types/options" {
  interface ComponentOptions<V extends Vue> {
    store?: Store<any>;
  }
}

declare module "vue/types/vue" {
  interface Vue {
    $store: Store<any>;
  }
}

What is expected?

I feel like it should be possible to override this with store?: Store<MyState> and $store: Store<MyState> to allow this.$store etc. on the Vue instance to be fully typed.

What is actually happening?

You can't redeclare an interface property, so trying to do so will result in a TypeScript error.


It feels like if you go to all the effort of fully typing out your whole vuex store it's rendered pretty much useless if your app makes heavy use of this.$store.state.foo. This is especially an issue for me because I use nuxt and do a lot with $store in the asyncData functions. I've searched around for a fix or a workaround but not come up with much. Is there something I am missing here?

@ktsn
Copy link
Member

ktsn commented Feb 13, 2019

Duplicate of #994

@ktsn ktsn marked this as a duplicate of #994 Feb 13, 2019
@ktsn ktsn closed this as completed Feb 13, 2019
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

2 participants