@@ -215,26 +215,34 @@ export class Parser {
215
215
this . extractPropsFromTypeIfStatelessComponent ( type ) ||
216
216
this . extractPropsFromTypeIfStatefulComponent ( type ) ;
217
217
218
+ const resolvedComponentName = componentNameResolver ( exp , source ) ;
219
+ const displayName =
220
+ resolvedComponentName || computeComponentName ( exp , source ) ;
221
+ const description = this . findDocComment ( commentSource ) . fullComment ;
222
+
218
223
if ( propsType ) {
219
- const resolvedComponentName = componentNameResolver ( exp , source ) ;
220
- const componentName =
221
- resolvedComponentName || computeComponentName ( exp , source ) ;
222
224
const defaultProps = this . extractDefaultPropsFromComponent ( exp , source ) ;
223
225
const props = this . getPropsInfo ( propsType , defaultProps ) ;
224
226
225
227
for ( const propName of Object . keys ( props ) ) {
226
228
const prop = props [ propName ] ;
227
- const component : Component = { name : componentName } ;
229
+ const component : Component = { name : displayName } ;
228
230
if ( ! this . propFilter ( prop , component ) ) {
229
231
delete props [ propName ] ;
230
232
}
231
233
}
232
234
233
235
return {
234
- description : this . findDocComment ( commentSource ) . fullComment ,
235
- displayName : componentName ,
236
+ description,
237
+ displayName,
236
238
props
237
239
} ;
240
+ } else if ( description && displayName ) {
241
+ return {
242
+ description,
243
+ displayName,
244
+ props : { }
245
+ } ;
238
246
}
239
247
240
248
return null ;
@@ -375,7 +383,7 @@ export class Parser {
375
383
let mainComment = ts . displayPartsToString (
376
384
symbol . getDocumentationComment ( this . checker )
377
385
) ;
378
-
386
+
379
387
if ( mainComment ) {
380
388
mainComment = mainComment . replace ( '\r\n' , '\n' ) ;
381
389
}
0 commit comments