File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,10 @@ export function validateProp (
2121 const absent = ! hasOwn ( propsData , key )
2222 let value = propsData [ key ]
2323 // handle boolean props
24- if ( isBooleanType ( prop . type ) ) {
24+ if ( isType ( Boolean , prop . type ) ) {
2525 if ( absent && ! hasOwn ( prop , 'default' ) ) {
2626 value = false
27- } else if ( value === '' || value === hyphenate ( key ) ) {
27+ } else if ( ! isType ( String , prop . type ) && ( value === '' || value === hyphenate ( key ) ) ) {
2828 value = true
2929 }
3030 }
@@ -168,12 +168,12 @@ function getType (fn) {
168168 return match && match [ 1 ]
169169}
170170
171- function isBooleanType ( fn ) {
171+ function isType ( type , fn ) {
172172 if ( ! Array . isArray ( fn ) ) {
173- return getType ( fn ) === 'Boolean'
173+ return getType ( fn ) === getType ( type )
174174 }
175175 for ( let i = 0 , len = fn . length ; i < len ; i ++ ) {
176- if ( getType ( fn [ i ] ) === 'Boolean' ) {
176+ if ( getType ( fn [ i ] ) === getType ( type ) ) {
177177 return true
178178 }
179179 }
You can’t perform that action at this time.
0 commit comments