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

[TSX] Optional props(with default) from mixins or extends are treated as required #2039

Closed
wonderful-panda opened this issue Sep 2, 2020 · 1 comment

Comments

@wonderful-panda
Copy link
Contributor

Version

3.0.0-rc.9

Reproduction link

https://github.com/wonderful-panda/vue-next/blob/tsx-typeerror/test-dts/defineComponent.test-d.tsx#L667-L669

Steps to reproduce

  1. checkout tsx-typeerror branch of wonderful-panda/vue-next
  2. Run build and test-dts

Below code is a simplified example.
mP1 should be optional, but treated as required in TSX.

const Mixin = defineComponent({
  props: {
      mP1: { type: String, default: "a" }
  }
})

const MyComponent = defineComponent({
  mixins: [Mixin]
}

const elm = <MyComponent /> // TS2322 Property 'mP1' is missing


/* extends also has same problem */

const MyComponent2 = defineComponent({
  extends: Mixin
}

const elm = <MyComponent2 /> // TS2322 Property 'mP1' is missing

What is expected?

no error (mP1 is treated as optional)

What is actually happening?

mP1 is treated as required and compilation error TS2322 occurred.

@HcySunYang
Copy link
Member

This issue no longer exists in the latest version

@github-actions github-actions bot locked and limited conversation to collaborators Oct 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants