Name of the interface to find (e.g., 'UserProfile')
Path to the current file being processed (used for relative search)
Parsed interface definition or null if not found
This function searches for a specific interface definition starting with the cache, then the current file's directory. It performs cross-file lookups to find interface definitions that may be defined in separate TypeScript files, enabling flexible interface referencing in
// In /api/users.js, looking for UserProfile interface
const userInterface = findInterface('UserProfile', '/api/users.js');
if (userInterface) {
console.log(`Found ${userInterface.properties.length} properties`);
}
// First call parses and caches
const interface1 = findInterface('UserProfile', '/api/users.js');
// Second call returns cached result
const interface2 = findInterface('UserProfile', '/api/users.js');
// interface1 === interface2 (same reference)
Finds a TypeScript interface definition by name in the current file or project