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

Mixin types are not merged correctly for methods #3468

Closed
Justineo opened this issue Mar 23, 2021 · 0 comments · Fixed by #3481
Closed

Mixin types are not merged correctly for methods #3468

Justineo opened this issue Mar 23, 2021 · 0 comments · Fixed by #3481

Comments

@Justineo
Copy link
Member

Version

3.0.7

Reproduction link

https://codesandbox.io/s/youthful-keldysh-r3e0h?file=/src/index.ts

Steps to reproduce

See the following code:

import { defineComponent } from "vue";

defineComponent({
  mixins: [
    defineComponent({ methods: { foo() {} } }),
    defineComponent({ methods: { bar() {} } })
  ],
  mounted () {
    console.log(this.foo, this.bar)
  }
})

defineComponent({
  mixins: [
    defineComponent({ methods: { foo() {} } }),
    defineComponent({})
  ],
  mounted () {
    console.log(this.foo) // Property 'foo' does not exist on type ...
  }
})

If two mixins both have defined some method, the result type is correctly merged. Otherwise all method types will be unavailable.

What is expected?

Method types are correctly merged.

What is actually happening?

If two mixins both have defined some method, the result type is correctly merged. Otherwise all method types will be unavailable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant