-
-
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
Boolean props default value is not undefined #5863
Comments
Related Issues #5847 |
This is intended behavior. Maybe you should submit a PR with your proposal to vuejs/docs |
@posva Then I would need to know the intended behavior for all the types. |
This is annoying default for |
According to this unit test, Yes. |
The Boolean missing prop will cast to false instead of undefined, vuejs/core#5863 (comment)
The Boolean missing prop will cast to false instead of undefined, vuejs/core#5863 (comment)
The Boolean missing prop will cast to false instead of undefined, vuejs/core#5863 (comment)
…cast to false instead of undefined, vuejs/core#5863 (comment) (#536) (#537) * fix: update named slots diagram Close #1688 * Correct default value for absent props. (#1705) The Boolean missing prop will cast to false instead of undefined, vuejs/core#5863 (comment) Co-authored-by: Natalia Tepluhina <[email protected]> Co-authored-by: sondh0127 <[email protected]>
Version
3.2.31
Reproduction link
sfc.vuejs.org/
Steps to reproduce
See the minimal reproduction.
What is expected?
Both
myValue
andmyOtherValue
should beundefined
by default.What is actually happening?
myOtherValue
(where only the type constructor is defined) ends upfalse
instead.That a
Boolean
ends upfalse
by default kinda makes sense, but is also inconsistent with the documentation. All the types should all behave predictably for consistency, so either the documentation needs to specify this, or it has to be changed.The documentation states that "An absent optional prop will have undefined value" at https://vuejs.org/guide/components/props.html#prop-validation (A bit down under "Additional details:")
The text was updated successfully, but these errors were encountered: