implementing Circular Dependencies in TypeScript with Decorators and Interfaces
I'm relatively new to this, so bear with me. I've been banging my head against this for hours. I'm working with a question with circular dependencies while using decorators in TypeScript. I have two classes, `User` and `Profile`, that reference each other, and I'm trying to use a decorator to add metadata to a property in the `User` class that points to the `Profile` class. However, I'm running into a `want to find name 'Profile'` behavior when I try to compile my code. Here's a simplified version of what I have: ```typescript // profile.ts export class Profile { constructor(public bio: string) {} } // user.ts import { Profile } from './profile'; function LogProfile(target: any, key: string) { console.log(`Logging profile for: ${key}`); } export class User { @LogProfile public profile: Profile; constructor(public name: string, profile: Profile) { this.profile = profile; } } ``` When I run this code, I get the behavior: `want to find name 'Profile'`. I understand that this might be due to the way TypeScript handles circular dependencies, but Iām not sure how to resolve it while still using decorators effectively. I've tried moving the decorator function to a separate file and importing it, but the scenario continues. I've also considered using type assertions, but I want to avoid that if possible. Any guidance on how to properly structure these classes to avoid this scenario while keeping the decorators functional would be greatly appreciated! For context: I'm using Typescript on Ubuntu. Any ideas what could be causing this? Any ideas what could be causing this?