Proptype boolean | undefined typecasts to false if no default is set
Vue version
vue 3.2.37
Link to minimal reproduction
Steps to reproduce
set an interface property value to possibly undefined and also boolean (can also be boolean | any) don't set a default value receive false instead of undefined
What is expected?
It should NOT typecast to false. This is not consistent with any other type
What is actually happening?
typecasts to false
System Info
System:
OS: Windows 10 10.0.22000
CPU: (12) x64 AMD Ryzen 5 3600X 6-Core Processor
Memory: 7.91 GB / 15.93 GB
Binaries:
Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.15 - C:\Program Files\nodejs\yarn.CMD
npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22000.120.0), Chromium (103.0.1264.44)
Internet Explorer: 11.0.22000.120
Any additional comments?
vue-tsc 0.37.9 Could also be a vue tsc issue
All props are optional by default, unless required: true is specified.
An absent optional prop other than Boolean will have undefined value.
The Boolean absent props will be cast to false. You should set a default value for it in order to get desired behavior.
Apparently it's in the docs, but regardless, it is a horrible feature. Undefined and false have literally nothing in common.