Boolean props default value is not undefined
Version
3.2.31
Reproduction link
Steps to reproduce
See the minimal reproduction.
What is expected?
Both myValue
and myOtherValue
should be undefined
by default.
What is actually happening?
myOtherValue
(where only the type constructor is defined) ends up false
instead.
That a Boolean
ends up false
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:")
This is annoying default for boolean
, while other type e.g string
return undefined
by default. only boolean return false
?
This is annoying default for
boolean
, while other type e.gstring
returnundefined
by default. only boolean returnfalse
?
According to this unit test, Yes.