@hrefcl/apidoc - v4.0.5
    Preparing search index...
    • Extracts all TypeScript interface definitions from a source file

      Parameters

      • filePath: string

        Absolute path to the TypeScript file to parse

      Returns Map<string, ParsedInterface>

      Map of interface names to their parsed definitions

      This function reads and parses a TypeScript file to extract all interface definitions. It handles complex nested structures, inheritance, and caches results for performance. The function is resilient to parsing errors and will log warnings for problematic files.

      const interfaces = extractInterfacesFromFile('/src/types/user.ts');
      console.log(interfaces.get('UserProfile'));
      // Returns: { name: 'UserProfile', properties: [...], extends: undefined }
      const interfaces = extractInterfacesFromFile('/src/types/api.ts');
      for (const [name, definition] of interfaces) {
      console.log(`Found interface: ${name} with ${definition.properties.length} properties`);
      }

      Logs warning and returns empty Map if file cannot be read or parsed

      4.0.0