Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardTypeScriptpolymorphic thisSingle-choice MCQ

Given a polymorphic `this` parameter, why is the final call rejected?

interface Comparable { compareTo(other: this): number; } class Money implements Comparable { constructor(public cents: number) {} compareTo(other: this) { return this.cents - other.cents; } } class Wallet implements Comparable { constructor(public n: number) {} compareTo(other: this) { return this.n - other.n; } } new Money(100).compareTo(new Wallet(3));