From a7c42ac7cb0e3d7186fe8e02ce3745d6eaa1c998 Mon Sep 17 00:00:00 2001 From: Lazyuki Date: Thu, 26 Dec 2019 18:10:30 -0500 Subject: [PATCH] Fallback to type.aliasSymbol Fixes #179 based on the comment there. --- src/parser.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/parser.ts b/src/parser.ts index 983870c8..47eea9fd 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -226,17 +226,19 @@ export class Parser { exp.valueDeclaration || exp.declarations![0] ); let commentSource = exp; + const typeSymbol = type.symbol || type.aliasSymbol; if (!exp.valueDeclaration) { - if (!type.symbol) { + if (!typeSymbol) { return null; } - exp = type.symbol; + exp = typeSymbol; const expName = exp.getName(); if ( expName === 'StatelessComponent' || expName === 'Stateless' || expName === 'StyledComponentClass' || + expName === 'StyledComponent' || expName === 'FunctionComponent' ) { commentSource = this.checker.getAliasedSymbol(commentSource); @@ -247,9 +249,9 @@ export class Parser { // Skip over PropTypes that are exported if ( - type.symbol && - (type.symbol.getEscapedName() === 'Requireable' || - type.symbol.getEscapedName() === 'Validator') + typeSymbol && + (typeSymbol.getEscapedName() === 'Requireable' || + typeSymbol.getEscapedName() === 'Validator') ) { return null; }