ts-api-utils - v3.0.0-rc.1
    Preparing search index...

    Function collectVariableUsage

    • Creates a mapping of each declared type and value to its type information.

      Parameters

      • sourceFile: SourceFile

      Returns Map<Identifier, VariableInfo>

      declare const sourceFile: ts.SourceFile;

      const usage = collectVariableUsage(sourceFile);

      for (const [identifier, information] of usage) {
      console.log(`${identifier.getText()} is used ${information.uses.length} time(s).`);
      }