1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
denoland-deno/cli/tests/testdata/private_field_presence.ts
Kitson Kelly 345f0fbe5c
feat(cli): update to TypeScript 4.5 (#12410)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-12-10 09:12:21 +11:00

20 lines
388 B
TypeScript

export class Person {
#name: string;
constructor(name: string) {
this.#name = name;
}
equals(other: unknown) {
return other &&
typeof other === "object" &&
#name in other &&
this.#name === other.#name;
}
}
const a = new Person("alice");
const b = new Person("bob");
const c = new Person("alice");
console.log(a.equals(b));
console.log(a.equals(c));