| 207 | }; |
| 208 | |
| 209 | const getComponentFromExport = exp => { |
| 210 | const decl = exp.valueDeclaration || exp.declarations[0]; |
| 211 | const type = checker.getTypeOfSymbolAtLocation(exp, decl); |
| 212 | const typeSymbol = type.symbol || type.aliasSymbol; |
| 213 | |
| 214 | if (!typeSymbol) { |
| 215 | return exp; |
| 216 | } |
| 217 | |
| 218 | const symbolName = typeSymbol.getName(); |
| 219 | |
| 220 | if ( |
| 221 | (symbolName === 'MemoExoticComponent' || |
| 222 | symbolName === 'ForwardRefExoticComponent') && |
| 223 | exp.valueDeclaration && |
| 224 | ts.isExportAssignment(exp.valueDeclaration) && |
| 225 | ts.isCallExpression(exp.valueDeclaration.expression) |
| 226 | ) { |
| 227 | const component = checker.getSymbolAtLocation( |
| 228 | exp.valueDeclaration.expression.arguments[0] |
| 229 | ); |
| 230 | |
| 231 | if (component) return component; |
| 232 | } |
| 233 | return exp; |
| 234 | }; |
| 235 | |
| 236 | const getParent = node => { |
| 237 | let parent = node; |
no outgoing calls
no test coverage detected
searching dependent graphs…