Make Props required by default
What problem does this feature solve?
The short syntax for typed props is not usable, because these properties are not required by default. So the long syntax should always be used, with the required properties to specify it and the optional properties to set their default value.
I think the code would gain in reliability and readability, if the props were required by default, and the "required" property was removed from the definition and it was the presence of the "default" property, even "null" or "undefined", that made the prop optional.
What does the proposed API look like?
...
propA: Number, // Required number
propB: [String, Number], // Required number or string
// Required string -> Deprecated
propC: {
type: String,
required: true // Useless
},
// Number with a default value
propD: {
type: Number,
default: 100 // Make prop optional
},
...