Explore Library
Code QuizIntermediate

Overriding With a Bad Signature

An overriding method whose return type is incompatible with the base method causes a type error.

Codetypescript
class Logger {
  format(message: string): string {
    return `[LOG] ${message}`;
  }
}

class TimestampLogger extends Logger {
  format(message: string): number {
    return Date.now();
  }
}

What is the bug in this code?