Angular Modernizer
    Preparing search index...

    Finds all references to named symbols (class, method, function, variable, constant) across a ts-morph Project, e.g. to determine call paths and blast radius before a fix.

    Uses ts-morph findReferences() under the hood. The project must already have the relevant source files added before calling UsageFinder.findUsages.

    Two additional sources close gaps that would otherwise produce a false "0 usages" all-clear:

    • unresolved: same-name identifiers whose symbol does not resolve (e.g. a class still used as a type after its import was removed, TS2304).
    • template: Angular template usages (component/directive selectors, pipe names, member reads/calls/bindings) in templateUrl files and inline templates, see TemplateUsageFinder.
    const finder = new UsageFinder(project);
    const usages = finder.findUsages('UserService', { file: '/src/app/user.component.ts' });
    // usages[0] -> { file, line, col, snippet, usageType: 'read' }
    Index

    Constructors

    Methods

    Constructors

    • Parameters

      • project: Project

        A ts-morph Project instance with source files already added.

      • options: TemplateUsageFinderOptions = {}

        componentDecorators: project component decorators in addition to Component (parser.componentDecorators), used for template usages.

      Returns UsageFinder

    Methods

    • Finds all usages of the named symbol across the project.

      Parameters

      • symbol: string

        The symbol name to search for (class, method, function, variable, constant).

      • options: FindUsagesOptions = {}

        Optional filters for file scope and usage type.

      Returns SymbolUsage[]

      Array of resolved usages, sorted by file path then line number.