@@ -33,7 +33,7 @@ function getEnumValues(path) {
33
33
}
34
34
35
35
function getPropTypeOneOf ( argumentPath ) {
36
- var type = { name : 'enum' } ;
36
+ var type : PropTypeDescriptor = { name : 'enum' } ;
37
37
if ( ! types . ArrayExpression . check ( argumentPath . node ) ) {
38
38
type . computed = true ;
39
39
type . value = printValue ( argumentPath ) ;
@@ -44,7 +44,7 @@ function getPropTypeOneOf(argumentPath) {
44
44
}
45
45
46
46
function getPropTypeOneOfType ( argumentPath ) {
47
- var type = { name : 'union' } ;
47
+ var type : PropTypeDescriptor = { name : 'union' } ;
48
48
if ( ! types . ArrayExpression . check ( argumentPath . node ) ) {
49
49
type . computed = true ;
50
50
type . value = printValue ( argumentPath ) ;
@@ -55,7 +55,7 @@ function getPropTypeOneOfType(argumentPath) {
55
55
}
56
56
57
57
function getPropTypeArrayOf ( argumentPath ) {
58
- var type = { name : 'arrayOf' } ;
58
+ var type : PropTypeDescriptor = { name : 'arrayOf' } ;
59
59
var subType = getPropType ( argumentPath ) ;
60
60
61
61
if ( subType . name === 'unknown' ) {
@@ -68,22 +68,24 @@ function getPropTypeArrayOf(argumentPath) {
68
68
}
69
69
70
70
function getPropTypeShape ( argumentPath ) {
71
- var type : { name : string ; value: any ; } = { name : 'shape' , value : 'unkown' } ;
71
+ var type : PropTypeDescriptor = { name : 'shape' , value : 'unkown' } ;
72
72
if ( ! types . ObjectExpression . check ( argumentPath . node ) ) {
73
73
argumentPath = resolveToValue ( argumentPath ) ;
74
74
}
75
75
76
76
if ( types . ObjectExpression . check ( argumentPath . node ) ) {
77
- type . value = { } ;
77
+ var value = { } ;
78
78
argumentPath . get ( 'properties' ) . each ( function ( propertyPath ) {
79
- var descriptor = getPropType ( propertyPath . get ( 'value' ) ) ;
79
+ var descriptor : PropDescriptor | PropTypeDescriptor =
80
+ getPropType ( propertyPath . get ( 'value' ) ) ;
80
81
var docs = getDocblock ( propertyPath ) ;
81
82
if ( docs ) {
82
83
descriptor . description = docs ;
83
84
}
84
85
descriptor . required = isRequiredPropType ( propertyPath . get ( 'value' ) ) ;
85
- type . value [ getPropertyName ( propertyPath ) ] = descriptor ;
86
+ value [ getPropertyName ( propertyPath ) ] = descriptor ;
86
87
} ) ;
88
+ type . value = value ;
87
89
}
88
90
89
91
return type ;
0 commit comments