-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
inconsisten behaviour of missing required boolean prop #7177
Comments
It's similar to #5847. |
Expected and documented behavior. Missing Boolean props are cast to https://vuejs.org/guide/components/props.html#boolean-casting I get though, that we could improve this docs section as it can be misunderstood (and has a few typos in the types in the composition API example). |
Could you please point me to the docs section saying that the type of |
Edit: I closed this issues here as the "expected behavior" was worded as "should pass I kinda missed that you also described the types problem reported in #7487. Can we continue discussion about that bug in that new issue, as it doesn't have two topics intertwined? |
I was just about to write that my issue is also about the type, that's fine, let's keep the discussion in the other issue |
Vue version
3.2.45
Link to minimal reproduction
https://sfc.vuejs.org/#__DEV__eNqFUstOwzAQ/JWVL6FSY6vhgkLSFnHjAEhcfUkbtzXUD9lOEYry76yTgtJW0IvjmZ3ZcdZuyYO19NAIkpPCr520AbwIjYV9pbclJ8FzMudaKmtcgEejLGycUZBQFkG0JvdcF2wwoxRBEMruqyAQARS9ieG+YKMCmZKhaaoqS9+90XiENhr4sYDJOfRM5DAoYk52IVifM9Zo+7Gla6PYEmvMNTpIJdLaqOUtzejsjtXShzFPhVfpyplPLxwmcjIdNWdIHoRLndC1cML9G3amPQk8q12ExsyO6w4H8DPBK8OvxUZq8eqM9UUL0b8yZp/3q6g0jn9gssUp54PL4yL1FnE3v5lcuandbD50blt4ent5poNZbr5uIj+BrisYisbi7C91diHvz4Ni/EJZltAc/6yGBSS/IIH8vB3uRs1On1H3DVFf8Xc=
Steps to reproduce
Create component with required boolean and string prop, use this component without passing any prop
What is expected?
Either boolean prop should be passed as
undefined
or it shouldn't be throwingmissing prop
warningAdditionally
foo?: boolean
prop type isboolean | undefined
, while with the object declaration (foo: Boolean
, norequired: true
) it's justboolean
as expectedWhat is actually happening?
boolean prop is passed as
false
string prop is passed as
undefined
System Info
No response
Any additional comments?
If it's not a bug then at least it's confusing and bad DX in my opinion
The text was updated successfully, but these errors were encountered: