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

fix(types): add a type-only differentiator to assist Mixin's type infer #3481

Merged
merged 3 commits into from
Mar 29, 2021
Merged

fix(types): add a type-only differentiator to assist Mixin's type infer #3481

merged 3 commits into from
Mar 29, 2021

Conversation

HcySunYang
Copy link
Member

@HcySunYang HcySunYang commented Mar 25, 2021

Fix: #3468

I noticed that when the mixins contain empty components:

defineComponent({
  mixins: [
    defineComponent({ methods: { foo() {} } }),
    // empty component
    defineComponent({})
  ]
})

Or they have the same type pattern:

defineComponent({
  mixins: [
    defineComponent({ props: [], methods: { foo() {} } }),
    // props type are same
    defineComponent({ props: [] })
  ]
})

Then the Mixin type is not inferred as the Unions type of the two components. So my idea is to add a type-only differentiator to help infer the type of Mixin.

@HcySunYang HcySunYang linked an issue Mar 25, 2021 that may be closed by this pull request
@HcySunYang HcySunYang requested a review from pikax March 25, 2021 04:21
@HcySunYang
Copy link
Member Author

@pikax I updated the PR, can you give a new review

@HcySunYang HcySunYang added 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: types labels Mar 27, 2021
@yyx990803 yyx990803 merged commit 5db2b14 into vuejs:master Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mixin types are not merged correctly for methods
3 participants