File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -266,6 +266,44 @@ describe('getPropType', () => {
266
266
} ) ;
267
267
} ) ;
268
268
269
+ it ( 'detects descriptions on nested types in arrayOf' , ( ) => {
270
+ expect (
271
+ getPropType (
272
+ expression ( `arrayOf(
273
+ /**
274
+ * test2
275
+ */
276
+ string
277
+ )` ) ,
278
+ ) ,
279
+ ) . toEqual ( {
280
+ name : 'arrayOf' ,
281
+ description : 'test2' ,
282
+ value : {
283
+ name : 'string' ,
284
+ } ,
285
+ } ) ;
286
+ } ) ;
287
+
288
+ it ( 'detects descriptions on nested types in objectOf' , ( ) => {
289
+ expect (
290
+ getPropType (
291
+ expression ( `objectOf(
292
+ /**
293
+ * test2
294
+ */
295
+ string
296
+ )` ) ,
297
+ ) ,
298
+ ) . toEqual ( {
299
+ name : 'objectOf' ,
300
+ description : 'test2' ,
301
+ value : {
302
+ name : 'string' ,
303
+ } ,
304
+ } ) ;
305
+ } ) ;
306
+
269
307
it ( 'detects descriptions on nested types in shapes' , ( ) => {
270
308
expect (
271
309
getPropType (
Original file line number Diff line number Diff line change @@ -86,6 +86,12 @@ function getPropTypeOneOfType(argumentPath) {
86
86
87
87
function getPropTypeArrayOf ( argumentPath ) {
88
88
const type : PropTypeDescriptor = { name : 'arrayOf' } ;
89
+
90
+ const docs = getDocblock ( argumentPath ) ;
91
+ if ( docs ) {
92
+ type . description = docs ;
93
+ }
94
+
89
95
const subType = getPropType ( argumentPath ) ;
90
96
91
97
if ( subType . name === 'unknown' ) {
@@ -99,6 +105,12 @@ function getPropTypeArrayOf(argumentPath) {
99
105
100
106
function getPropTypeObjectOf ( argumentPath ) {
101
107
const type : PropTypeDescriptor = { name : 'objectOf' } ;
108
+
109
+ const docs = getDocblock ( argumentPath ) ;
110
+ if ( docs ) {
111
+ type . description = docs ;
112
+ }
113
+
102
114
const subType = getPropType ( argumentPath ) ;
103
115
104
116
if ( subType . name === 'unknown' ) {
You can’t perform that action at this time.
0 commit comments