Angular Modernizer
    Preparing search index...

    Analysis rule angular:type-safety.

    Detects four categories of type safety violations across all TypeScript code:

    1. Explicit any types on properties, parameters, and return types
    2. Untyped function/method parameters (no type annotation, no default, not rest)
    3. Missing explicit return type annotations on functions and class methods
    4. Class properties with no type annotation whose inferred type is any/unknown (no initializer, null/undefined/[] initializers, untyped calls)

    Scope:

    • Analyzes standalone FunctionDeclaration nodes and class MethodDeclaration nodes
    • Analyzes all Parameter and PropertyDeclaration descendants
    • Skips .d.ts declaration files entirely

    Known Limitations:

    • Arrow functions (const fn = () => {}) and function expressions are NOT scanned for missing return types. Only FunctionDeclaration and MethodDeclaration are analyzed. This is intentional to keep the rule focused on explicit declarations.

    Overlap with MissingReturnTypeRule:

    • Both rules flag missing return types on class methods.
    • MissingReturnTypeRule is Angular-specific: it skips Angular lifecycle hooks (ngOnInit, ngOnDestroy, etc.) and reports under the Angular framework lens.
    • TypeSafetyAnalysisRule is general TypeScript type safety: no lifecycle hook skipping, broader scope including standalone functions.
    • Double-reporting is intentional; users can disable one rule if preferred.
    const rule = new TypeSafetyAnalysisRule();
    const results = await rule.analyze(context);

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    category: "angular-typescript" = 'angular-typescript'

    Rule category for grouping.

    description: "Detects type safety violations including explicit any, untyped parameters, untyped return types, and untyped class properties" = 'Detects type safety violations including explicit any, untyped parameters, untyped return types, and untyped class properties'

    Rule description explaining what it checks.

    id: "angular:type-safety" = 'angular:type-safety'

    Unique rule identifier (scoped to plugin). Format: "plugin-name:rule-name" (e.g., "angular-standalone:component-not-standalone")

    name: "Type Safety" = 'Type Safety'

    Human-readable rule name.

    severity: "warning" = 'warning'

    Rule severity level.

    tags: string[] = ...

    Tags for filtering and search.

    Methods