All academies
All challenges

Apply constructor Dependency Injection

Dependency Injection

solution.ts
medium+80 XP

Create `interface Mailer { send(to: string): string }`, `ConsoleMailer`, and `AuthService` that receives Mailer via constructor and `register(email)` calls mailer.send.

Hints
  • ConsoleMailer.send should return 'sent:' + to
  • AuthService constructor(private mailer: Mailer)

Judge

Press Run tests to execute your solution in the sandbox judge.