@@ -359,7 +359,7 @@ module.exports = {
359
359
value . callee . object &&
360
360
hasCustomValidator ( value . callee . object . name )
361
361
) {
362
- return true ;
362
+ return { } ;
363
363
}
364
364
365
365
if (
@@ -387,23 +387,20 @@ module.exports = {
387
387
switch ( callName ) {
388
388
case 'shape' :
389
389
if ( skipShapeProps ) {
390
- return true ;
390
+ return { } ;
391
391
}
392
392
393
393
if ( argument . type !== 'ObjectExpression' ) {
394
394
// Invalid proptype or cannot analyse statically
395
- return true ;
395
+ return { } ;
396
396
}
397
397
const shapeTypeDefinition = {
398
398
type : 'shape' ,
399
399
children : [ ]
400
400
} ;
401
401
iterateProperties ( argument . properties , ( childKey , childValue ) => {
402
402
const fullName = [ parentName , childKey ] . join ( '.' ) ;
403
- let types = buildReactDeclarationTypes ( childValue , fullName ) ;
404
- if ( types === true ) {
405
- types = { } ;
406
- }
403
+ const types = buildReactDeclarationTypes ( childValue , fullName ) ;
407
404
types . fullName = fullName ;
408
405
types . name = childKey ;
409
406
types . node = childValue ;
@@ -413,10 +410,7 @@ module.exports = {
413
410
case 'arrayOf' :
414
411
case 'objectOf' :
415
412
const fullName = [ parentName , '*' ] . join ( '.' ) ;
416
- let child = buildReactDeclarationTypes ( argument , fullName ) ;
417
- if ( child === true ) {
418
- child = { } ;
419
- }
413
+ const child = buildReactDeclarationTypes ( argument , fullName ) ;
420
414
child . fullName = fullName ;
421
415
child . name = '__ANY_KEY__' ;
422
416
child . node = argument ;
@@ -430,7 +424,7 @@ module.exports = {
430
424
! argument . elements . length
431
425
) {
432
426
// Invalid proptype or cannot analyse statically
433
- return true ;
427
+ return { } ;
434
428
}
435
429
const unionTypeDefinition = {
436
430
type : 'union' ,
@@ -439,7 +433,7 @@ module.exports = {
439
433
for ( let i = 0 , j = argument . elements . length ; i < j ; i ++ ) {
440
434
const type = buildReactDeclarationTypes ( argument . elements [ i ] , parentName ) ;
441
435
// keep only complex type
442
- if ( type !== true ) {
436
+ if ( Object . keys ( type ) . length > 0 ) {
443
437
if ( type . children === true ) {
444
438
// every child is accepted for one type, abort type analysis
445
439
unionTypeDefinition . children = true ;
@@ -451,7 +445,7 @@ module.exports = {
451
445
}
452
446
if ( unionTypeDefinition . length === 0 ) {
453
447
// no complex type found, simply accept everything
454
- return true ;
448
+ return { } ;
455
449
}
456
450
return unionTypeDefinition ;
457
451
case 'instanceOf' :
@@ -462,11 +456,11 @@ module.exports = {
462
456
} ;
463
457
case 'oneOf' :
464
458
default :
465
- return true ;
459
+ return { } ;
466
460
}
467
461
}
468
462
// Unknown property or accepts everything (any, object, ...)
469
- return true ;
463
+ return { } ;
470
464
}
471
465
472
466
/**
@@ -792,10 +786,7 @@ module.exports = {
792
786
ignorePropsValidation = true ;
793
787
return ;
794
788
}
795
- let types = buildReactDeclarationTypes ( value , key ) ;
796
- if ( types === true ) {
797
- types = { } ;
798
- }
789
+ const types = buildReactDeclarationTypes ( value , key ) ;
799
790
types . fullName = key ;
800
791
types . name = key ;
801
792
types . node = value ;
0 commit comments