-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
defineComponent infers props incorrectly when prop is Function type #1891
Labels
Comments
This will be fixed in the next release. |
@HcySunYang I also thought this was fixed by your PR but it seems to fail: master...test/types/props-default |
Is not fixed yet. This is caused by the |
@pikax Aha, I just saw that you have submitted a PR for this issue, but our approach is different. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version
3.0.0-rc.5
Reproduction link
https://codesandbox.io/s/cranky-gareth-k92ch?file=/src/test.ts
Screenshots
Steps to reproduce
Before get started, make sure you have set your script language to
ts
defineComponent
methodFunction as PropType<() => void>
NOOP
in@vue/shared
or() => { }
props.methodYouDefined()
What is expected?
Expect the type system correctly infers the type of the prop that you defined.
The current implementation says the
prop.value
's type is(void | () => void)
, which is combined result ofprop.type
and typeof result ofprop.default
.the expected result should be
() => void
which is the combined result ofprop.type
and typeofprop.default
What is actually happening?
The text was updated successfully, but these errors were encountered: