/** * @angular-modernizer/plugin-angular - Untyped Dynamic Component Rule * * Detects `.instance` accesses on `ComponentRef`-typed expressions that lack * an explicit type contract. Dynamic component hosts that access component * members through an untyped (or `any`-typed) `ComponentRef` create implicit * contracts that the TypeScript compiler cannot verify. * * Detection scope: * - `PropertyAccessExpression` nodes whose name is `instance` and whose * expression resolves to a type that includes `ComponentRef`. * - Only flagged when the `.instance` access is itself chained with a member * access (`.instance.memberName`), indicating an actual contract use. * * Skipped: * - `.d.ts` declaration files. * - `ComponentRef` where `T` is a concrete (non-`any`, non-`unknown`) * named type — the contract is already explicit. * - Accesses preceded by a type assertion (`as IMyInterface` or * ``), which means the developer has opted in to explicit * typing at the call site. * - Event member accesses when `checkEventSubscriptions` config option is * `false`. * * @example * ```typescript * const rule = new UntypedDynamicComponentRule(); * const results = await rule.analyze(createContext(sourceFile, project)); * // results[0].metadata.accessedMember → 'setData' * // results[0].metadata.memberType → 'method' * // results[0].metadata.isFullyUntyped → true * ``` */ import type { AnalysisRule, AnalysisContext, AnalysisResult } from '@angular-modernizer/plugin-system'; export interface UntypedDynamicComponentConfig { checkEventSubscriptions: boolean; } export interface UntypedDynamicComponentMetadata { violationType: 'untyped-dynamic-component'; accessedMember: string; memberType: 'method' | 'property' | 'event'; componentRefExpression: string; componentRefType: string; isFullyUntyped: boolean; hasAnyType: boolean; refactoringComplexity: 'medium' | 'high'; } export declare class UntypedDynamicComponentRule implements AnalysisRule { readonly id = "angular:untyped-dynamic-component"; readonly name = "Implicit Contract"; readonly description = "Detects untyped .instance access on ComponentRef without explicit type contracts"; readonly severity: "warning"; readonly category = "angular-architecture"; readonly tags: string[]; private readonly config; constructor(config?: Partial); analyze(context: AnalysisContext): Promise; private detectUntypedDynamicComponent; private isComponentRefType; private extractGenericArg; private hasTypeAssertion; private determineMemberType; private generateMessage; private generateSuggestedFix; } //# sourceMappingURL=untyped-dynamic-component.analysis.rule.d.ts.map