| 55 | } |
| 56 | |
| 57 | function findComponentClassName(sourceFile: ts.SourceFile): string | undefined { |
| 58 | for (const statement of sourceFile.statements) { |
| 59 | if (!ts.isClassDeclaration(statement) || !statement.name) continue; |
| 60 | |
| 61 | if (statement.heritageClauses) { |
| 62 | for (const clause of statement.heritageClauses) { |
| 63 | if (clause.token !== ts.SyntaxKind.ExtendsKeyword) continue; |
| 64 | for (const type of clause.types) { |
| 65 | const text = type.expression.getText(sourceFile); |
| 66 | if (text === 'Component' || text === 'StatefulComponent') { |
| 67 | return statement.name.text; |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | return undefined; |
| 74 | } |
| 75 | |
| 76 | function extractViewModelProps(sourceFile: ts.SourceFile): string[] { |
| 77 | const props: string[] = []; |