(typeSymbol, source, defaultProps)
| 492 | }; |
| 493 | |
| 494 | const getPropsForClassComponent = (typeSymbol, source, defaultProps) => { |
| 495 | const childs = source.getChildAt(0); |
| 496 | let stop; |
| 497 | |
| 498 | for (let i = 0, n = childs.getChildCount(); i < n && !stop; i++) { |
| 499 | const c = childs.getChildAt(i); |
| 500 | if (!ts.isClassDeclaration(c)) continue; |
| 501 | |
| 502 | if (!c.heritageClauses) continue; |
| 503 | |
| 504 | for (const clause of c.heritageClauses) { |
| 505 | if (clause.token !== ts.SyntaxKind.ExtendsKeyword) continue; |
| 506 | const t = clause.types[0]; |
| 507 | const propType = t.typeArguments[0]; |
| 508 | |
| 509 | const type = checker.getTypeFromTypeNode(propType); |
| 510 | |
| 511 | return getProps( |
| 512 | type.getProperties(), |
| 513 | typeSymbol, |
| 514 | [], |
| 515 | defaultProps |
| 516 | ); |
| 517 | } |
| 518 | } |
| 519 | }; |
| 520 | |
| 521 | const getDefaultPropsValues = properties => |
| 522 | properties.reduce((acc, p) => { |
no test coverage detected
searching dependent graphs…