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

[TypeScript] Can not access props in mapState #1032

Closed
galenyuan opened this issue Oct 31, 2017 · 5 comments
Closed

[TypeScript] Can not access props in mapState #1032

galenyuan opened this issue Oct 31, 2017 · 5 comments
Labels
bug Something isn't working

Comments

@galenyuan
Copy link

Version

3.0.0

Reproduction link

https://github.com/galenyuan/todomvc-vue-typescript/blob/master/src/pages/Home.vue#L63

Steps to reproduce

npm i
npm run dev

What is expected?

no errors

What is actually happening?

(63,22): error TS2339: Property 'type' does not exist on type 'VueConstructor<Vue>'.
@ktsn ktsn added the bug Something isn't working label Oct 31, 2017
@HerringtonDarkholme
Copy link
Member

We probably cannot support accessing this in mapState or so.

Vue uses ThisType to check this in methods. However, ThisType will only work in object literal contexually typed, or object literal which is a direct child of another ThisTyped object literal.

Simply put, you cannot infer this in mapState. You have to define it as an object literal, not in a function call.

HerringtonDarkholme added a commit to HerringtonDarkholme/vuex that referenced this issue Nov 5, 2017
@galenyuan
Copy link
Author

what about note it in doc if can not support accessing this in mapState?

@SidKwok
Copy link

SidKwok commented Nov 8, 2017

Any progress on this issue?

@ktsn
Copy link
Member

ktsn commented Nov 8, 2017

#1044

@ryutamaki
Copy link

ryutamaki commented Dec 29, 2017

I said in #1044 but let me say again here.
Could you merge and release this feature or please let us know when that would be merged?

@ktsn ktsn closed this as completed in 7c7ed1d Jan 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants