Skip to content

AngularAstAnalyzer

Defined in: packages/analyzer/src/analyzers/angular/angular-analyzer.ts:105

new AngularAstAnalyzer(): AngularAstAnalyzer;

AngularAstAnalyzer

analyzeFile(filePath): FileAnalysis;

Defined in: packages/analyzer/src/analyzers/angular/angular-analyzer.ts:137

Analyze a single TypeScript file.

Prefers a SourceFile from the configured ts.Program (so the type checker can resolve literal unions on the same AST nodes we extract). Falls back to a fresh ts.createSourceFile parse when no program is set or the file is not part of it.

Parameter Type
filePath string

FileAnalysis


resolveUnionLiterals(typeNode, sourceFile): ResolveUnionResult;

Defined in: packages/analyzer/src/analyzers/angular/angular-analyzer.ts:863

Resolve literal union values for a type node using the TypeChecker.

Returns a discriminated result distinguishing the four failure modes from success. Operates on the AST node directly — Phase 2 removed the position- matching hack now that analyzeFile reuses the program’s SourceFile.

If typeNode is undefined the caller has nothing to resolve; we report not-union (no union type to talk about) without emitting a diagnostic.

Parameter Type
typeNode TypeNode | undefined
sourceFile SourceFile

ResolveUnionResult


setDiagnostics(collector): void;

Defined in: packages/analyzer/src/analyzers/angular/angular-analyzer.ts:125

Optional diagnostics collector. When set, non-ok outcomes from resolveUnionLiterals are reported as severity: 'warn' with code union-resolution-<kind>. Safe to leave unset (analyzer used outside the CLI).

Parameter Type
collector DiagnosticsCollector

void


setTypeChecker(program): void;

Defined in: packages/analyzer/src/analyzers/angular/angular-analyzer.ts:115

Set a TypeChecker for resolving literal union type values. When set, input properties will include resolvedValues for string/number literal unions.

Parameter Type
program Program

void