mike-north / typescript-courses

Mike North's TypeScript Courses
https://frontendmasters.com/teachers/mike-north/
377 stars 536 forks source link

Equality check instead of assignment when comparing private properties #1120

Open j-machuca opened 3 months ago

j-machuca commented 3 months ago
equals(other: unknown) {
    if (other && typeof other === "object" && #serialNumber in other) {
      other;
      // ^?
      return other.#serialNumber = this.#serialNumber;
    }
    return false;
  }

I believe that the intent was to return true not to assign a new value to #serialNumber