79329216

Date: 2025-01-04 16:53:14
Score: 1
Natty:
Report link

You can solve this problem by using a getter for the faqs property. A getter lets you dynamically access the email value without encountering the issue of trying to use a variable before it’s been fully defined.

interface Config {
  email: string;
  faqs: Array<FAQ>;
}

export interface FAQ {
  question: string;
  answer: string;
}

export const config: Config = {
  email: "[email protected]",
  get faqs(): Array<FAQ> {
    return [
      {
        question: "simple question",
        answer: `I want to refer to ${this.email} here`,
      },
    ];
  },
};
Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Andres Aranda