@@ -359,7 +359,7 @@ module.exports = {
359359 value . callee . object &&
360360 hasCustomValidator ( value . callee . object . name )
361361 ) {
362- return true ;
362+ return { } ;
363363 }
364364
365365 if (
@@ -387,23 +387,20 @@ module.exports = {
387387 switch ( callName ) {
388388 case 'shape' :
389389 if ( skipShapeProps ) {
390- return true ;
390+ return { } ;
391391 }
392392
393393 if ( argument . type !== 'ObjectExpression' ) {
394394 // Invalid proptype or cannot analyse statically
395- return true ;
395+ return { } ;
396396 }
397397 const shapeTypeDefinition = {
398398 type : 'shape' ,
399399 children : [ ]
400400 } ;
401401 iterateProperties ( argument . properties , ( childKey , childValue ) => {
402402 const fullName = [ parentName , childKey ] . join ( '.' ) ;
403- let types = buildReactDeclarationTypes ( childValue , fullName ) ;
404- if ( types === true ) {
405- types = { } ;
406- }
403+ const types = buildReactDeclarationTypes ( childValue , fullName ) ;
407404 types . fullName = fullName ;
408405 types . name = childKey ;
409406 types . node = childValue ;
@@ -413,10 +410,7 @@ module.exports = {
413410 case 'arrayOf' :
414411 case 'objectOf' :
415412 const fullName = [ parentName , '*' ] . join ( '.' ) ;
416- let child = buildReactDeclarationTypes ( argument , fullName ) ;
417- if ( child === true ) {
418- child = { } ;
419- }
413+ const child = buildReactDeclarationTypes ( argument , fullName ) ;
420414 child . fullName = fullName ;
421415 child . name = '__ANY_KEY__' ;
422416 child . node = argument ;
@@ -430,7 +424,7 @@ module.exports = {
430424 ! argument . elements . length
431425 ) {
432426 // Invalid proptype or cannot analyse statically
433- return true ;
427+ return { } ;
434428 }
435429 const unionTypeDefinition = {
436430 type : 'union' ,
@@ -439,7 +433,7 @@ module.exports = {
439433 for ( let i = 0 , j = argument . elements . length ; i < j ; i ++ ) {
440434 const type = buildReactDeclarationTypes ( argument . elements [ i ] , parentName ) ;
441435 // keep only complex type
442- if ( type !== true ) {
436+ if ( Object . keys ( type ) . length > 0 ) {
443437 if ( type . children === true ) {
444438 // every child is accepted for one type, abort type analysis
445439 unionTypeDefinition . children = true ;
@@ -451,7 +445,7 @@ module.exports = {
451445 }
452446 if ( unionTypeDefinition . length === 0 ) {
453447 // no complex type found, simply accept everything
454- return true ;
448+ return { } ;
455449 }
456450 return unionTypeDefinition ;
457451 case 'instanceOf' :
@@ -462,11 +456,11 @@ module.exports = {
462456 } ;
463457 case 'oneOf' :
464458 default :
465- return true ;
459+ return { } ;
466460 }
467461 }
468462 // Unknown property or accepts everything (any, object, ...)
469- return true ;
463+ return { } ;
470464 }
471465
472466 /**
@@ -792,10 +786,7 @@ module.exports = {
792786 ignorePropsValidation = true ;
793787 return ;
794788 }
795- let types = buildReactDeclarationTypes ( value , key ) ;
796- if ( types === true ) {
797- types = { } ;
798- }
789+ const types = buildReactDeclarationTypes ( value , key ) ;
799790 types . fullName = key ;
800791 types . name = key ;
801792 types . node = value ;
0 commit comments