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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: add typing support #1717

Merged
merged 2 commits into from Apr 23, 2020
Merged

types: add typing support #1717

merged 2 commits into from Apr 23, 2020

Conversation

kiaking
Copy link
Member

@kiaking kiaking commented Apr 18, 2020

fix #994

Celebrating Vue Beta 2 release, now we can argument type our $store custom property in Vue Component 馃帀 This PR adds typing support for Vuex 4.

  • Add missing types, and update Vue interfaces.
  • Upgrade TS to 3.8.
  • Upgrade tsconfig to align with Vue 3 (support Map and such).
  • Bring back type test in testing.

@kiaking kiaking added types Related to typings only 4.x labels Apr 18, 2020
@kiaking kiaking requested a review from ktsn April 18, 2020 05:07
@kiaking kiaking self-assigned this Apr 18, 2020
types/vue.d.ts Outdated
declare module "vue/types/vue" {
interface Vue {
declare module "@vue/runtime-core" {
interface ComponentCustomProperties {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we remove store type from instance? We have an issue about this at #994

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah didn't see that issue, but yea, it makes sense. Let me remove the declaration from ComponentCustomProperties. We can keep ComponentCustomOptions since it doesn't matter so much right...? (it wouldn't be used by users to check store types anyway).

Do you think it can be applied to Vue 3 as well? Or would it be breaking change...? 馃

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can keep ComponentCustomOptions since it doesn't matter so much right...?

Yes, I think so.

Do you think it can be applied to Vue 3 as well?

Do you mean Vuex 3? As it's technically breaking change, we should only apply it for Vuex 4.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got ya. I'll also put this to my todo list to add in docs as well. I'll update the PR 馃憤

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated! I've removed the type test where checking this.$store as well.

@kiaking
Copy link
Member Author

kiaking commented Apr 20, 2020

I've added section in README that explains the new typings due to #994 change.

Copy link
Member

@ktsn ktsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 馃憤

@ktsn ktsn merged commit 5b44e8e into 4.0 Apr 23, 2020
@ktsn ktsn deleted the 4.0-types branch April 23, 2020 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x types Related to typings only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants