type Animal = {
age: number;
type: 'dog',
};
const person = {
name: 'zero',
age: 28,
sayName() {
this;
this.name;
},
/*
this: {
name: string;
age: number;
sayName(): void;
sayAge(this: Animal): void;
}
*/
// (property) name: string
sayAge(this: Animal) {
this;
this.type;
}
};
// this: Animal
// (property) type: "dog"
person.sayAge.bind({ age: 3, type: 'dog' });